summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/pgf-spectra/pgf-spectra.sty
blob: 5d3fecdd93078b18f08b80b10b99883b377eaf88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
% Hugo Gomes @ 15/04/2016 (v1.0)
% Hugo Gomes @ 15/03/2021 (v2.0.0)
% Hugo Gomes @ 12/05/2021 (v2.1.0)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{pgf-spectra}[12/05/2021 pgf-spectra v2.1.0]%
\RequirePackage{tikz}%
\DeclareOption{LSE}{\input{spectra.data.LSE.tex}}%
\DeclareOption{NIST}{\input{spectra.data.NIST.tex}}%
\ExecuteOptions{NIST}%
\ProcessOptions\relax%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{wlIRcolor}{rgb}{.3157,.2373,.2373}% NEW v2.0.0
\definecolor{wlUVcolor}{rgb}{.3,.2568,.3}% NEW v2.0.0
%
\newcount\wl@counta% tmp counter
\newcount\wl@countb% tmp counter
\newcount\wl@countc% tmp counter
\newcount\wl@countd% tmp counter
%
\newif\ifwl@absorption%
\newif\ifcur@elem@exist%
\newif\ifwl@drawaxis%
\newif\ifwl@axislabel%
\newif\ifwl@intensity%
\newif\ifwl@redshift% NEW v2.0.0
\newif\ifwl@RSvalue% NEW v2.0.0
\newif\ifwl@usevisibleshade% NEW v2.1.0
% defining PGF keys
\pgfkeys{/wl/.cd,%
element/.get=\wl@element,%
element/.store in=\wl@element,%
element/.default=NONE,%
width/.get=\wl@width,%
width/.store in=\wl@width,%
width/.default={0.9\textwidth},%
height/.get=\wl@height,%
height/.store in=\wl@height,%
height/.default=1cm,%
back/.get=\wl@back,%
back/.store in=\wl@back,%
back/.default=black,%
backIRUV/.get=\wl@backnotvisible,% NEW v2.0.0
backIRUV/.store in=\wl@backnotvisible,% NEW v2.0.0
backIRUV/.default=black,% NEW v2.0.0
backVIS/.get=\wl@backvisible,% NEW v2.1.0
backVIS/.store in=\wl@backvisible,% NEW v2.1.0
backVIS/.default=black,% NEW v2.1.0
IRcolor/.get=\wl@IRcolor,% NEW v2.0.0
IRcolor/.store in=\wl@IRcolor,% NEW v2.0.0
IRcolor/.default=wlIRcolor,% NEW v2.0.0
UVcolor/.get=\wl@UVcolor,% NEW v2.0.0
UVcolor/.store in=\wl@UVcolor,% NEW v2.0.0
UVcolor/.default=wlUVcolor,% NEW v2.0.0
charge/.get=\wl@charge,%
charge/.store in=\wl@charge,%
charge/.default=0,%
Imin/.get=\wl@intmin,%
Imin/.store in=\wl@intmin,%
Imin/.default=0,%
lines/.get=\wl@lines,%
lines/.store in=\wl@lines,%
lines/.default={},%
line width/.get=\wl@linewidth,%
line width/.store in=\wl@linewidth,%
line width/.default=1pt,%
begin/.get=\wl@begin,%
begin/.store in=\wl@begin,%
begin/.default=380,%
end/.get=\wl@end,%
end/.store in=\wl@end,%
end/.default=780,%
axis step/.get=\wl@axisstep,%
axis step/.store in=\wl@axisstep,%
axis step/.default=20,%
axis unit/.get=\wl@axisunit,% NEW v2.1.0
axis unit/.store in=\wl@axisunit,% NEW v2.1.0
axis unit/.default=nm,% NEW v2.1.0
axis unit precision/.get=\wl@axisunitprecision,% NEW v2.1.0
axis unit precision/.store in=\wl@axisunitprecision,% NEW v2.1.0
axis unit precision/.default=3,% NEW v2.1.0
axis ticks/.get=\wl@axisticks,% NEW v2.0.0
axis ticks/.store in=\wl@axisticks,% NEW v2.0.0
axis ticks/.default=0,% NEW v2.0.0
axis color/.get=\wl@axiscolor,%
axis color/.store in=\wl@axiscolor,%
axis color/.default=black,%
axis font/.get=\wl@axisfont,%
axis font/.store in=\wl@axisfont,%
axis font/.default={\tiny},%
axis font color/.get=\wl@axisfontcolor,%
axis font color/.store in=\wl@axisfontcolor,%
axis font color/.default=white,%
label position/.get=\wl@labelposition,%
label position/.store in=\wl@labelposition,%
label position/.default={west},%
label before text/.get=\wl@labelbtext,%
label before text/.store in=\wl@labelbtext,%
label before text/.default={},%
label after text/.get=\wl@labelatext,%
label after text/.store in=\wl@labelatext,%
label after text/.default={},%
label font/.get=\wl@labelfont,%
label font/.store in=\wl@labelfont,%
label font/.default={\bfseries\small},%
label font color/.get=\wl@labelfontcolor,%
label font color/.store in=\wl@labelfontcolor,%
label font color/.default=black,%
gamma/.get=\wl@gamma,%
gamma/.store in=\wl@gamma,%
gamma/.default=0.8,%
brightness/.get=\wl@brightness,%
brightness/.store in=\wl@brightness,%
brightness/.default=1,%
line intensity/.get=\wl@lineint,%
line intensity/.store in=\wl@lineint,%
line intensity/.default=100,%
relative intensity threshold/.get=\wl@relintthresh,%
relative intensity threshold/.store in=\wl@relintthresh,%
relative intensity threshold/.default=0.25,%
absorption/.is if=wl@absorption,%
axis/.is if=wl@drawaxis,%
label/.is if=wl@axislabel,%
relative intensity/.is if=wl@intensity,%
redshift/.get=\wl@redshift,% NEW v2.0.0
redshift/.store in=\wl@redshift,% NEW v2.0.0
redshift/.default={},% NEW v2.0.0
show redshift value/.is if=wl@RSvalue,% NEW v2.0.0
use visible shading/.is if=wl@usevisibleshade% NEW v2.1.0
}%
% setting keys with default values
\pgfkeys{/wl/.cd,element,width,height,back,backIRUV,IRcolor,UVcolor,charge,Imin,lines,line width,begin,end,% NEW v2.0.0 -> backIRUV,IRcolor,UVcolor
axis color,axis font,axis font color,axis step,axis unit,axis unit precision,axis ticks,label position,label before text,label after text,label font,label font color,gamma,brightness,line intensity,% NEW v2.1.0 -> axis unit,axis unit precision
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
use visible shading,backVIS}% NEW v2.1.0 -> use visible shading
% strings for \ifx tests
\def\wlN@NE{NONE}%
\def\wl@ll{all}%
\def\wl@visible{visible}%
\def\wl@visible@list{visible,visible5,visible10,visible15,visible20,visible25,visible30,visible35,visible40,visible45,visible50,visible55,visible60,visible65,visible70,visible75,visible80,visible85,visible90,visible95,visible100}%
\def\wl@label@position@list{west,north west,north,north east,east,south east,south,south west}%
\def\wl@redshift@D{D}% NEW v2.0.0
\def\wl@axisunit@nm{nm}% NEW v2.1.0
\def\wl@axisunit@um{micron}% NEW v2.1.0
\def\wl@axisunit@A{A}% NEW v2.1.0
%%%% COMMANDS -------------------------------------------------------------------------------->
% commands ##################################################
\newif\ifpgfspectra@StyleIsDef\pgfspectra@StyleIsDeffalse% NEW v2.0.0
% \pgfspectraStyle[options]% NEW v2.0.0
\def\pgfspectraStyle[#1]{\pgfspectraStyleReset\pgfspectra@StyleIsDeftrue\relax\tikzset{/wl/.cd,#1}%
\def\pgfspectra@DoStyle{\tikzset{/wl/.cd,#1}}% applies storing user style for future use
}% NEW v2.0.0
% \pgfspectraStyleReset% NEW v2.0.0
\def\pgfspectraStyleReset{\pgfspectra@StyleIsDeffalse\tikzset{/wl/.cd,%
element=NONE,width=0.9\textwidth,height=1cm,back=black,backIRUV=black,IRcolor=wlIRcolor,UVcolor=wlUVcolor,%
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
label before text={},label after text={},label font=\bfseries\small,label font color=black,gamma=0.8,brightness=1,line intensity=100,%
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
use visible shading,backVIS=black}}% NEW v2.1.0 -> use visible shading
% --------------- The main command to draw the spectra -----------------------------------------
% \pgfspectra[options]
\def\pgfspectra{\@ifnextchar[\wl@pgfspectra@withoptions{\wl@pgfspectra@nooptions}}%
\def\wl@pgfspectra@nooptions{\wl@pgfspectra@continuous(0.9\textwidth,1cm)}%
% ##########################################################
\def\wl@pgfspectra@continuous(#1,#2){\ignorespaces%
\ifwl@usevisibleshade% NEW v2.1.0
\pgfspectrashade(380,780){wl@visibleshade}%
\tikz{\fill[shading=wl@visibleshade] (0,0) rectangle (#1,#2);}%
\else%
\begin{tikzpicture}%
\pgfmathparse{#1/400}\edef\xscale{\pgfmathresult}
\pgfmathparse{1.4*\xscale+.09*\linewidth/\wl@width}\edef\wl@linewidth{\pgfmathresult}% NEW v2.0.0 {\xscale} -> {1.4*\xscale+.09*\linewidth/\wl@width}
\foreach \x in {380,...,780}%
        {%
        \wlcolor{\x}%
        \pgfmathparse{(\x-380)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
        \draw[wl@temp,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,#2);%
        }%
\end{tikzpicture}%
\fi%
}%
% ##########################################################
\def\wl@pgfspectra@withoptions[#1]{\ignorespaces%
% setting default values or user style
\ifpgfspectra@StyleIsDef\pgfspectraStyleReset\pgfspectra@DoStyle\pgfspectra@StyleIsDeftrue\relax\else\pgfspectraStyleReset\relax\fi% NEW v2.0.0
% process options (key values)
\pgfkeys{/wl/.cd,#1}%
% axis height
\setbox0=\hbox{\wl@axisfont\selectfont380}\edef\@wl@axis@height{\the\ht0}%
% process visible background (visible+opacity)
\wl@counta=0%
\wl@countb=-1%
\@for\@myarg:=\wl@visible@list\do{%
            \ifx\wl@back\@myarg\wl@countb=\wl@counta\fi%
            \advance\wl@counta by1%
            }%
\ifnum\wl@countb=-1\edef\@visible@opacity{1}\else% NEW v2.0.0
\ifnum\wl@countb=0\let\wl@back\wl@visible\edef\@visible@opacity{.5}\else%
\ifnum\wl@countb>0\let\wl@back\wl@visible\pgfmathparse{.05*\wl@countb}\edef\@visible@opacity{\pgfmathresult}\fi\fi\fi%
% ----------------------------------------------------------------------------------------------------------
% check limits... % NEW v2.0.0
\ifnum\wl@end<10\relax\def\wldez{10}\let\wl@end\wldez\fi%
\ifnum\wl@end>4000\relax\def\wlquatromil{4000}\let\wl@end\wlquatromil\fi%
\ifnum\wl@begin<10\relax\def\wldez{10}\let\wl@begin\wldez\fi%
\ifnum\wl@begin>4000\relax\def\wlquatromil{4000}\let\wl@begin\wlquatromil\fi%
% ----------------------------------------------------------------------------------------------------------
% verifying redshift key
\ifx\wl@redshift\@empty\relax%
\wl@redshiftfalse%
\else%
\wl@processredshiftkey\wl@redshift\relax%
\fi%
% ----------------------------------------------------------------------------------------------------------
% if no element provided draws continuous spectrum with options or user list of lines
\ifx\wl@element\wlN@NE%no element by the user
    \ifx\wl@elt@chemsym\undefined\else\let\wl@elt@chemsym\undefined\fi%
    \ifx\wl@lines\@empty%no lines by the user => continuous spectrum
    % draws the continuous spectrum width options (default or by the user)
    \begin{tikzpicture}%
        \pgfkeys{/wl/.cd,#1}% NEW v2.0.0
        \pgfmathparse{\wl@width/(abs(\wl@end-\wl@begin))}\edef\xscale{\pgfmathresult}%
        \ifwl@drawaxis%draws the axis
        \wl@utils@draw@axis%
        \fi%\ifwl@drawaxis
        \ifwl@axislabel%put the label
        \wl@utils@put@label%
        \fi%\ifwl@axislabel
        \let\wl@back\wl@visible%
        \let\wl@background@UVcolor\wl@backnotvisible\let\wl@background@IRcolor\wl@backnotvisible\relax%
        \wl@utils@drawbackground{\@visible@opacity*\wl@brightness}%
    \end{tikzpicture}%
    \let\wl@list@@\@empty%
    \else% lines by the user
    \edef\wl@list@@{\wl@lines}%
    \let\wl@background@UVcolor\wl@backnotvisible\let\wl@background@IRcolor\wl@backnotvisible\relax%
    \fi%\wl@lines\@empty
\else%\wl@element\wlN@NE
    % else get element(s) data
    \wl@countc=0%
    \wl@countd=1%
    \@for\@myarg:=\wl@element\do{\advance\wl@countc by1}%count number of elements
    \wl@addt@list{}{}%
    \@for\@myarg:=\wl@element\do{%
            \cur@elem@existtrue%
            \def\wl@elt@chemsym{NOT FOUND!}%
            \def\@search@result@err{NOT FOUND!}%
            \wl@elt@data{\@myarg}\relax%
            % check if element provided exists
            \ifx\@search@result@err\wl@elt@chemsym Element\ ``\@myarg'' with charge ``\wl@charge'' not found!\cur@elem@existfalse\else%
            % if exists, set the wavelength's list
            \wl@set@element@list{\wl@elt@elemdata}{\wl@elt@Imax}%
            \fi%\@search@result@err\wl@elt@chemsym
            \ifcur@elem@exist\ifnum\wl@countd<\wl@countc\wl@addt@list{\wl@list@@}{,}\fi\fi%
            \advance\wl@countd by1%
            }%end do
\fi%\wl@element\wlN@NE
% check if there are lines to draw and make the spectrum
    \ifx\wl@list@@\@empty\ifx\wl@element\wlN@NE\else Element\ ``\wl@element'' with charge ``\wl@charge'' have no lines to display.\fi\else%
        \ifwl@absorption%absortion spectrum
        \begin{tikzpicture}%
                \pgfkeys{/wl/.cd,#1}% NEW v2.0.0
                \pgfmathparse{\wl@width/(abs(\wl@end-\wl@begin))}\edef\xscale{\pgfmathresult}%
                \ifwl@drawaxis%draws the axis
                \wl@utils@draw@axis%
                \fi%\ifwl@drawaxis
                \ifwl@axislabel%put the label
                \wl@utils@put@label%
                \fi%\ifwl@axislabel
                \let\wl@back\wl@visible%
                \let\wl@background@UVcolor\wl@UVcolor\let\wl@background@IRcolor\wl@IRcolor\relax%
                \wl@utils@drawbackground{\wl@brightness}%
                % draws the lines
                \wl@utils@drawabsorptionlines%
        \end{tikzpicture}%
        \else%emission spectrum
        % draws the spectrum
        \ifx\wl@back\wl@visible%visible background
        \begin{tikzpicture}%
                \pgfkeys{/wl/.cd,#1}% NEW v2.0.0
                \pgfmathparse{\wl@width/(abs(\wl@end-\wl@begin))}\edef\xscale{\pgfmathresult}%
                \ifwl@drawaxis%draws the axis
                \wl@utils@draw@axis%
                \fi%\ifwl@drawaxis
                \ifwl@axislabel%put the label
                \wl@utils@put@label%
                \fi%\ifwl@axislabel
                \let\wl@background@UVcolor\wl@backnotvisible\let\wl@background@IRcolor\wl@backnotvisible\relax%
                \wl@utils@drawbackground{\@visible@opacity*\wl@brightness}%
                \wl@utils@drawemissionlines% emission lines
        \end{tikzpicture}%
        \else%without visible background
        \begin{tikzpicture}%
                \pgfkeys{/wl/.cd,#1}% NEW v2.0.0
                \pgfmathparse{\wl@width/(abs(\wl@end-\wl@begin))}\edef\xscale{\pgfmathresult}%
                \ifwl@drawaxis%draws the axis
                \wl@utils@draw@axis%
                \fi%\ifwl@drawaxis
                \ifwl@axislabel%put the label
                \wl@utils@put@label%
                \fi%\ifwl@axislabel
                \let\wl@background@UVcolor\wl@backnotvisible\let\wl@background@IRcolor\wl@backnotvisible\relax%
                \wl@utils@drawbackground{0}% dummy argument
                \wl@utils@drawemissionlines% emission lines
        \end{tikzpicture}%
        \fi%\wl@back\@visible
        \fi%\ifwl@absorption
    \fi% \wl@list@@\@empty
}%
% ##########################################################
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% get individual line data from one element of the array data
\def\wl@get@line@info[#1 #2 #3]{%
\def\@currentline@wl{#1}% return
\def\@currentline@int{#2}% return
\def\@currentline@charge{#3}% return
}%
% ######################################################################
% ################### \wl@set@element@list ####################################
% ######################################################################
%
% \wl@set@element@list{\wl@elt@elemdata}{\wl@elt@Imax}
% RETURN: \wl@list@@ -> (wl1,wl2,...)
%           or if relative intensity true (between 0 and 1)
%                \wl@list@@ -> (wl1/int1,wl2/int2,...)
%
\newif\ifwl@first% for first ocurrence of Imin
\def\wl@set@element@list#1#2{\ignorespaces% \wl@elt@Imax
\wl@firsttrue%
\wl@counta=0%
\wl@countb=1%
\pgfmathparse{int(\wl@intmin*100)}\edef\@wl@intmin{\pgfmathresult}%intensity percentage
\ifnum\@wl@intmin=0% include all intensities
\ifx\wl@ll\wl@charge%ALL lines
\@for\@myarg:=#1\do{\advance\wl@counta by1}%count all entries
        \ifwl@intensity%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \pgfmathparse{\wl@relintthresh+(1-\wl@relintthresh)*\@currentline@int/#2}\edef\wl@intensity@to@list{\pgfmathresult}%
        \ifnum\wl@countb<\wl@counta\wl@addt@list{\wl@list@@}{\@currentline@wl/\wl@intensity@to@list,}\else%
        \wl@addt@list{\wl@list@@}{\@currentline@wl/\wl@intensity@to@list}\fi%
        \advance\wl@countb by1%
        }%END do
        \else%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \ifnum\wl@countb<\wl@counta\wl@addt@list{\wl@list@@}{\@currentline@wl,}\else%
        \wl@addt@list{\wl@list@@}{\@currentline@wl}\fi%
        \advance\wl@countb by1%
        }%END do
        \fi%
\else% lines for one specific charge
\@for\@myarg:=#1\do{\expandafter\wl@get@line@info\@myarg\ifx\@currentline@charge\wl@charge\advance\wl@counta by 1\fi}%count only if is the desired charge
        \ifwl@intensity%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \pgfmathparse{\wl@relintthresh+(1-\wl@relintthresh)*\@currentline@int/#2}\edef\wl@intensity@to@list{\pgfmathresult}%
        \ifx\@currentline@charge\wl@charge%add to list if is the desired charge
            \ifnum\wl@countb<\wl@counta\wl@addt@list{\wl@list@@}{\@currentline@wl/\wl@intensity@to@list,}\else%
            \wl@addt@list{\wl@list@@}{\@currentline@wl/\wl@intensity@to@list}\fi%
        \advance\wl@countb by 1%
        \fi%
        }%END do
        \else%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \ifx\@currentline@charge\wl@charge%add to list if is the desired charge
            \ifnum\wl@countb<\wl@counta\wl@addt@list{\wl@list@@}{\@currentline@wl,}\else%
            \wl@addt@list{\wl@list@@}{\@currentline@wl}\fi%
        \advance\wl@countb by 1%
        \fi%
        }%END do
        \fi%
\fi%
\else%\wl@intmin>0 & \wl@intmin<1
\ifnum\@wl@intmin>100\else%
\pgfmathparse{\wl@intmin*#2}\edef\wl@actual@int{\pgfmathresult}%
\ifx\wl@ll\wl@charge%ALL lines
\@for\@myarg:=#1\do{\advance\wl@counta by 1}%count all entries
        \ifwl@intensity%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \pgfmathparse{notless(\@currentline@int,\wl@actual@int)}\relax\edef\wl@int@result{\pgfmathresult}%
        \ifnum\wl@int@result=1%
            \pgfmathparse{\wl@relintthresh+(1-\wl@relintthresh)*\@currentline@int/#2}\edef\wl@intensity@to@list{\pgfmathresult}%
            \ifwl@first\wl@addt@list{\wl@list@@}{\@currentline@wl/\wl@intensity@to@list}\else%
            \wl@addt@list{\wl@list@@}{,\@currentline@wl/\wl@intensity@to@list}\fi%
            \ifwl@first\wl@firstfalse\fi%
        \fi%
        \advance\wl@countb by 1%
        }%END do
        \else%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \pgfmathparse{notless(\@currentline@int,\wl@actual@int)}\relax\edef\wl@int@result{\pgfmathresult}%
        \ifnum\wl@int@result=1%
            \ifwl@first\wl@addt@list{\wl@list@@}{\@currentline@wl}\else%
            \wl@addt@list{\wl@list@@}{,\@currentline@wl}\fi%
            \ifwl@first\wl@firstfalse\fi%
        \fi%
        \advance\wl@countb by 1%
        }%END do
        \fi%
\else% lines for one specific charge
\@for\@myarg:=#1\do{\expandafter\wl@get@line@info\@myarg\ifx\@currentline@charge\wl@charge\advance\wl@counta by 1\fi}%count only if is the desired charge
        \ifwl@intensity%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \ifx\@currentline@charge\wl@charge%add to list if is the desired charge
            \pgfmathparse{notless(\@currentline@int,\wl@actual@int)}\edef\wl@int@result{\pgfmathresult}%
            \ifnum\wl@int@result=1%
            \pgfmathparse{\wl@relintthresh+(1-\wl@relintthresh)*\@currentline@int/#2}\edef\wl@intensity@to@list{\pgfmathresult}%
            \ifwl@first\wl@addt@list{\wl@list@@}{\@currentline@wl/\wl@intensity@to@list}\else%
            \wl@addt@list{\wl@list@@}{,\@currentline@wl/\wl@intensity@to@list}\fi%
            \ifwl@first\wl@firstfalse\fi%
        \fi%
        \advance\wl@countb by 1%
        \fi%
        }%END do
        \else%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \ifx\@currentline@charge\wl@charge%add to list if is the desired charge
            \pgfmathparse{notless(\@currentline@int,\wl@actual@int)}\edef\wl@int@result{\pgfmathresult}%
            \ifnum\wl@int@result=1%
            \ifwl@first\wl@addt@list{\wl@list@@}{\@currentline@wl}\else%
            \wl@addt@list{\wl@list@@}{,\@currentline@wl}\fi%
            \ifwl@first\wl@firstfalse\fi%
        \fi%
        \advance\wl@countb by 1%
        \fi%
        }%END do
        \fi%
\fi%
\fi%
\fi%
}%
% add to list
\def\wl@addt@list#1#2{\edef\wl@list@@{#1#2}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% internal utils
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\wl@utils@draw@axis{\ignorespaces%
                % axis unit -> NEW v2.1.0
                \pgfkeys{/pgf/number format/.cd,fixed,precision=\wl@axisunitprecision,set thousands separator={},assume math mode=true}
                \ifx\wl@axisunit\wl@axisunit@nm\relax%
                    \def\wl@axisunit@scale{1}\def\wl@axisunit@addzeros{}%
                \else\ifx\wl@axisunit\wl@axisunit@um\relax%
                    \def\wl@axisunit@scale{1000}\def\wl@axisunit@addzeros{}\pgfkeys{/pgf/number format/.cd,fixed zerofill}%
                \else\ifx\wl@axisunit\wl@axisunit@A\relax%
                    \def\wl@axisunit@scale{1}\def\wl@axisunit@addzeros{0}% probably not the best solution to overcome the TeX dimension limit values (16384pt)... but works!
                \fi\fi\fi%
                \ifnum\wl@begin>\wl@end%
                % New xshift={-2.5*\@wl@axis@height} to hold bigger numbers, e.g. 2500
                \draw[draw=none,fill=\wl@axiscolor] ([xshift={2.5*\@wl@axis@height}]0,\wl@height+2.5pt) rectangle ([xshift={-2.5*\@wl@axis@height}]-\wl@width,-2.5*\@wl@axis@height);%
                        % minor ticks -> NEW v2.0.0
                        \ifnum\wl@axisticks>0\relax%
                        \pgfmathparse{\wl@end+\wl@axisstep/(\wl@axisticks+1)}\pgfmathparse{int(\pgfmathresult)}%
                        \edef\@axis@list{\wl@end,\pgfmathresult,...,\wl@begin}%
                        \foreach \x in \@axis@list%
                        {%
                        \pgfmathparse{(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \draw[\wl@axisfontcolor!80!transparent,line width=.25pt] (\wl@currentx,-.375*\@wl@axis@height) -- ++(0,.375*\@wl@axis@height);%
                        }%
                        \fi%
                \pgfmathparse{\wl@end+\wl@axisstep}\pgfmathparse{int(\pgfmathresult)}%
                \edef\@axis@list{\wl@end,\pgfmathresult,...,\wl@begin}%
                \foreach \x in \@axis@list%
                {%
                \pgfmathparse{(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                \draw[\wl@axisfontcolor,line width=.25pt] (\wl@currentx,-.75*\@wl@axis@height) -- ++(0,.75*\@wl@axis@height);%
                \pgfmathparse{\x/\wl@axisunit@scale}\edef\wl@xscaledvalue{\pgfmathresult}% NEW v2.1.0
                \node[\wl@axisfontcolor,font=\wl@axisfont,above,inner sep=0pt] at (\wl@currentx,-2.25*\@wl@axis@height) {\pgfmathprintnumber{\wl@xscaledvalue}\wl@axisunit@addzeros};%
                }%
                \else%
                \draw[draw=none,fill=\wl@axiscolor] ([xshift={-2.5*\@wl@axis@height}]0,\wl@height+2.5pt) rectangle ([xshift={2.5*\@wl@axis@height}]\wl@width,-2.5*\@wl@axis@height);%
                        % minor ticks -> NEW v2.0.0
                        \ifnum\wl@axisticks>0\relax%
                        \pgfmathparse{\wl@begin+\wl@axisstep/(\wl@axisticks+1)}\pgfmathparse{int(\pgfmathresult)}%
                        \edef\@axis@list{\wl@begin,\pgfmathresult,...,\wl@end}%
                        \foreach \x in \@axis@list%
                        {%
                        \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \draw[\wl@axisfontcolor!80!transparent,line width=.25pt] (\wl@currentx,-.375*\@wl@axis@height) -- ++(0,.375*\@wl@axis@height);%
                        }%
                        \fi%
                \pgfmathparse{\wl@begin+\wl@axisstep}\pgfmathparse{int(\pgfmathresult)}%
                \edef\@axis@list{\wl@begin,\pgfmathresult,...,\wl@end}%
                \foreach \x in \@axis@list%
                {%
                \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                \draw[\wl@axisfontcolor,line width=.25pt] (\wl@currentx,-.75*\@wl@axis@height) -- ++(0,.75*\@wl@axis@height);%
                \pgfmathparse{\x/\wl@axisunit@scale}\edef\wl@xscaledvalue{\pgfmathresult}% NEW v2.1.0
                \node[\wl@axisfontcolor,font=\wl@axisfont,above,inner sep=0pt] at (\wl@currentx,-2.25*\@wl@axis@height) {\pgfmathprintnumber{\wl@xscaledvalue}\wl@axisunit@addzeros};%
                }%
                \fi%
}%
\def\wl@utils@put@label{\ignorespaces%
                \ifx\wl@elt@chemsym\undefined\def\wl@elt@chemsym{}\fi%
                \wl@get@label@position%
                \ifnum\wl@begin>\wl@end%
                        \ifcase\wl@label@position%
                        %west
                            \ifwl@drawaxis%\ifwl@axislabel%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,left,minimum width=2em,align=right] at (-2.5*\@wl@axis@height-\wl@width,0.5*\wl@height-1.25*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,left,minimum width=2em,align=right] at (-\wl@width,0.5*\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%north west
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,above right,inner xsep=0pt] at (-2.5*\@wl@axis@height-\wl@width,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,above right,inner xsep=0pt] at (-\wl@width,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%north
                        \node[\wl@labelfontcolor,font=\wl@labelfont,above] at (-0.5*\wl@width,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                        \or%north east
                        \ifwl@drawaxis%
                        \node[\wl@labelfontcolor,font=\wl@labelfont,above left,inner xsep=0pt] at (2.5*\@wl@axis@height,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                        \else%
                        \node[\wl@labelfontcolor,font=\wl@labelfont,above left,inner xsep=0pt] at (0,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                        \fi
                        \or%east
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,right] at (2.5*\@wl@axis@height,0.5*\wl@height-1.25*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,right] at (0,0.5*\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%south east
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below left,inner xsep=0pt] at (2.5*\@wl@axis@height,-2.5*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below left,inner xsep=0pt] at (0,0) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%south
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below] at (-0.5*\wl@width,-2.5*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below] at (-0.5*\wl@width,0) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%south west
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below right,inner xsep=0pt] at (-2.5*\@wl@axis@height-\wl@width,-2.5*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below right,inner xsep=0pt] at (-\wl@width,0) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \fi%
                \else%
                        \ifcase\wl@label@position%
                        %west
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,left,minimum width=2em,align=right] at (-2.5*\@wl@axis@height,0.5*\wl@height-1.25*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,left,minimum width=2em,align=right] at (0,0.5*\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%north west
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,above right,inner xsep=0pt] at (-2.5*\@wl@axis@height,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,above right,inner xsep=0pt] at (0,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%north
                        \node[\wl@labelfontcolor,font=\wl@labelfont,above] at (0.5*\wl@width,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                        \or%north east
                        \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,above left,inner xsep=0pt] at (\wl@width+2.5*\@wl@axis@height,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,above left,inner xsep=0pt] at (\wl@width,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%east
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,right] at ([xshift={2.5*\@wl@axis@height}]\wl@width,0.5*\wl@height-1.25*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,right] at (\wl@width,0.5*\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%south east
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below left,inner xsep=0pt] at (\wl@width+2.5*\@wl@axis@height,-2.5*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below left,inner xsep=0pt] at (\wl@width,0) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%south
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below] at (0.5*\wl@width,-2.5*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below] at (0.5*\wl@width,0) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%south west
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below right,inner xsep=0pt] at (-2.5*\@wl@axis@height,-2.5*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below right,inner xsep=0pt] at (0,0) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \fi%
                \fi%
}%
\def\wl@utils@drawbackground#1{\ignorespaces% NEW v2.0.0 - in this version draws from UV, VIS to IV -> replaces \wl@utils@visiblespectrum#1
% reprocess visible background (only visible) -> needed because of the override in keys
    \wl@counta=0%
    \wl@countb=-1%
    \@for\@myarg:=\wl@visible@list\do{%
            \ifx\wl@back\@myarg\wl@countb=\wl@counta\fi%
            \advance\wl@counta by1%
            }%
        \ifnum\wl@countb>-1\let\wl@back\wl@visible\fi%
            \ifwl@usevisibleshade\relax% NEW v2.1.0
                \pgfmathparse{int(#1*100)}\edef\wl@bright{\pgfmathresult}%
                \ifnum\wl@begin>\wl@end% 0
                    \ifnum\wl@end<380\relax% 1
                        \pgfmathparse{(\wl@end-380)*\xscale}\edef\wl@pointA{\pgfmathresult pt}%
                        \ifnum\wl@begin>780\relax% 2
                            \pgfmathparse{(\wl@end-780)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (-\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(380,780){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade,shading angle=180] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(380,\wl@begin){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade,shading angle=180] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \else% 1
                        \ifnum\wl@begin>780\relax% 2
                            \pgfmathparse{(\wl@end-780)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (-\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(\wl@end,780){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade,shading angle=180] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(\wl@end,\wl@begin){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade,shading angle=180] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \fi% 1
                \else% 0
                    \ifnum\wl@begin<380\relax% 1
                        \pgfmathparse{(380-\wl@begin)*\xscale}\edef\wl@pointA{\pgfmathresult pt}%
                        \ifnum\wl@end>780\relax% 2
                            \pgfmathparse{(780-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(380,780){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(380,\wl@end){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \else% 1
                        \ifnum\wl@end>780\relax% 2
                            \pgfmathparse{(780-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(\wl@begin,780){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(\wl@begin,\wl@end){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \fi% 1
                \fi%0
            \else% wl@usevisibleshade (don't use shading, draw line by line...)
                \pgfmathparse{int(#1*100)}\edef\wl@bright{\pgfmathresult}%
                \pgfmathparse{1.4*\xscale+.09*\linewidth/\wl@width}\edef\@wl@linewidth{\pgfmathresult}% NEW v2.0.0 {\xscale} -> {1.4*\xscale+.09*\linewidth/\wl@width}
                \ifnum\wl@begin>\wl@end% 0
                    \ifnum\wl@end<380\relax% 1
                        \pgfmathparse{(\wl@end-380)*\xscale}\edef\wl@pointA{\pgfmathresult pt}%
                        \ifnum\wl@begin>780\relax% 2
                            \pgfmathparse{(\wl@end-780)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (-\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {780,...,380}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\wl@pointB+(780-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {\wl@begin,...,380}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\wl@pointB+(\wl@begin-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \else% 1
                        \ifnum\wl@begin>780\relax% 2
                            \pgfmathparse{(\wl@end-780)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (-\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {780,...,\wl@end}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\wl@pointB+(780-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {\wl@begin,...,\wl@end}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\wl@pointB+(\wl@begin-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \fi% 1
                \else% 0
                    \ifnum\wl@begin<380\relax% 1
                        \pgfmathparse{(380-\wl@begin)*\xscale}\edef\wl@pointA{\pgfmathresult pt}%
                        \ifnum\wl@end>780\relax% 2
                            \pgfmathparse{(780-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {380,...,780}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\wl@pointB-(780-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {\wl@end,...,380}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\wl@pointB-(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \else% 1
                        \ifnum\wl@end>780\relax% 2
                            \pgfmathparse{(780-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {\wl@begin,...,780}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {\wl@begin,...,\wl@end}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \fi% 1
                \fi%0
            \fi% wl@usevisibleshade
}%
\def\wl@utils@drawabsorptionlines{\ignorespaces%
                \ifnum\wl@begin>\wl@end%
                    \ifwl@intensity%
                        \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x/\y in \wl@list@@%
                        {%
                        \pgfmathparse{notless(\x,\wl@end)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@begin)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \pgfmathparse{int(\y*100)}\edef\wl@black{\pgfmathresult}%
                        \wlcolor{\x}%
                        \colorlet{wlcolor}{black!\wl@black!wl@temp}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                    \else%
                        \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x in \wl@list@@%
                        {%
                        \pgfmathparse{notless(\x,\wl@end)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@begin)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \wlcolor{\x}%
                        \colorlet{wlcolor}{black!\wl@lineint!wl@temp}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                    \fi%
                \else%
                    \ifwl@intensity%
                        \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x/\y in \wl@list@@%
                        {%
                        \pgfmathparse{notless(\x,\wl@begin)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@end)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \pgfmathparse{int(\y*100)}\edef\wl@black{\pgfmathresult}%
                        \wlcolor{\x}%
                        \colorlet{wlcolor}{black!\wl@black!wl@temp}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                    \else%
                        \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x in \wl@list@@%
                        {%
                        \pgfmathparse{notless(\x,\wl@begin)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@end)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \wlcolor{\x}%
                        \colorlet{wlcolor}{black!\wl@lineint!wl@temp}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                    \fi%
                \fi%
\ifwl@RSvalue% NEW v2.0.0
\ifnum\wl@begin>\wl@end%
\ifwl@drawaxis\pgfmathparse{-\wl@width-2.5*\@wl@axis@height}\edef\wl@redshiftinfo@x{\pgfmathresult pt}%
\else\pgfmathparse{-\wl@width}\edef\wl@redshiftinfo@x{\pgfmathresult pt}\fi%
\else%
\ifwl@drawaxis\pgfmathparse{-2.5*\@wl@axis@height}\edef\wl@redshiftinfo@x{\pgfmathresult pt}%
\else\edef\wl@redshiftinfo@x{0pt}\fi%
\fi%
\ifwl@drawaxis\pgfmathparse{-.75*\@wl@axis@height-1.3*\ht0-2pt}\edef\wl@redshiftinfo@y{\pgfmathresult pt}\else\edef\wl@redshiftinfo@y{0pt}\fi%
\node[below right,inner xsep=0pt,font=\wl@axisfont] at (\wl@redshiftinfo@x,\wl@redshiftinfo@y) {\wl@redshiftinfo};%
\fi% NEW v2.0.0
}%
\def\wl@utils@drawemissionlines{\ignorespaces%
                \ifnum\wl@begin>\wl@end%
                \ifwl@intensity%
                    \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x/\y in \wl@list@@%
                        {%
                        \wlcolor{\x}%
                        \pgfmathparse{notless(\x,\wl@end)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@begin)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \pgfmathparse{int(\y*100)}\edef\wl@black{\pgfmathresult}%
                        \colorlet{wlcolor}{wl@temp!\wl@black!black}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                \else%
                    \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x in \wl@list@@%
                        {%
                        \wlcolor{\x}%
                        \pgfmathparse{notless(\x,\wl@end)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@begin)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \colorlet{wlcolor}{wl@temp!\wl@lineint!black}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                \fi%
                \else%
                \ifwl@intensity%
                    \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x/\y in \wl@list@@%
                        {%
                        \wlcolor{\x}%
                        \pgfmathparse{notless(\x,\wl@begin)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@end)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \pgfmathparse{int(\y*100)}\edef\wl@black{\pgfmathresult}%
                        \colorlet{wlcolor}{wl@temp!\wl@black!black}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                \else%
                    \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x in \wl@list@@%
                        {%
                        \wlcolor{\x}%
                        \pgfmathparse{notless(\x,\wl@begin)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@end)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \colorlet{wlcolor}{wl@temp!\wl@lineint!black}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                \fi%
                \fi%
\ifwl@RSvalue% NEW v2.0.0
\ifnum\wl@begin>\wl@end%
\ifwl@drawaxis\pgfmathparse{-\wl@width-2.5*\@wl@axis@height}\edef\wl@redshiftinfo@x{\pgfmathresult pt}%
\else\pgfmathparse{-\wl@width}\edef\wl@redshiftinfo@x{\pgfmathresult pt}\fi%
\else%
\ifwl@drawaxis\pgfmathparse{-2.5*\@wl@axis@height}\edef\wl@redshiftinfo@x{\pgfmathresult pt}%
\else\edef\wl@redshiftinfo@x{0pt}\fi%
\fi%
\ifwl@drawaxis\pgfmathparse{-.75*\@wl@axis@height-1.3*\ht0-2pt}\edef\wl@redshiftinfo@y{\pgfmathresult pt}\else\edef\wl@redshiftinfo@y{0pt}\fi%
\node[below right,inner xsep=0pt,font=\wl@axisfont] at (\wl@redshiftinfo@x,\wl@redshiftinfo@y) {\wl@redshiftinfo};%
\fi% NEW v2.0.0
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% return: integer with position (e.g. '0' for west, ... )
\def\wl@get@label@position{\ignorespaces%
\wl@countc=0%
\@for\@mylabel:=\wl@label@position@list%
            \do{%
            \ifx\@mylabel\wl@labelposition\edef\wl@label@position{\the\wl@countc}\fi%
            \advance\wl@countc by1%
            }%
}%
% NEW v2.0.0 ----------------------
% redshift: lambda(obs)=lambda(emit)*{(1+v/c*cos(theta))/sqrt(1-v^2/c^2)} ---> Relativistic Doppler
% vbar-> v/c -> normalized velocity of the source (e.g. '0.9' for v=0.9c )
% 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)
\def\wl@processredshiftkey#1{\ignorespaces%
\wl@redshiftfalse%
\edef\wl@redshiftkey@expand{#1}% to expand a value passed by a macro (not necessary if the user provided a number...)
\expandafter\wl@redshiftkey@firstchar\wl@redshiftkey@expand\relax%
\ifcat1\wl@@RedShift\relax%
\pgfmathparse{1+#1}\relax%
\edef\wl@UMMAISZ{\pgfmathresult}\wl@redshifttrue%
\edef\wl@redshiftinfo{redshift z=#1}%
\else%
\edef\wl@redshiftkey@expand{#1}%
\expandafter\wl@process@redshift\wl@redshiftkey@expand\relax%
\fi%
}%
\def\wl@redshiftkey@firstchar#1#2\relax{\edef\wl@@RedShift{#1}}%
\def\wl@process@redshift#1=#2/#3\relax{%
\edef\wl@redshifttest{#1}%
\ifx\wl@redshifttest\wl@redshift@D\relax%
\pgfmathparse{(1+#2*cos(#3))/sqrt(1-#2*#2)}%
\edef\wl@UMMAISZ{\pgfmathresult}\wl@redshifttrue%
\pgfmathparse{#2*cos(#3))/sqrt(1-#2*#2)}%
\edef\wl@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}})}%
\fi%
}%
% \wl@utils@redshift ---------------------------------------------------------------------
% returns the wllist with the shift computed
\def\wl@utils@redshift{\ignorespaces%
    \let\wt@backlist@@\wl@list@@\relax%
    \let\wl@list@@\@empty\relax%
    \wl@firsttrue\relax%
    \ifwl@intensity% list (lambda/intensity)
        \foreach \x/\y in \wt@backlist@@{%
            \pgfmathparse{\x*\wl@UMMAISZ}\edef\@currentline@wl{\pgfmathresult}%
            \ifwl@first\global\wl@addt@list{\wl@list@@}{\@currentline@wl/\y}\else%
                \global\wl@addt@list{\wl@list@@}{,\@currentline@wl/\y}\fi%
            \ifwl@first\global\wl@firstfalse\fi%
        }%
    \else% list (lambda)
        \foreach \x in \wt@backlist@@{%
            \pgfmathparse{\x*\wl@UMMAISZ}\edef\@currentline@wl{\pgfmathresult}%
            \ifwl@first\global\wl@addt@list{}{\@currentline@wl}\else%
                \global\wl@addt@list{\wl@list@@}{,\@currentline@wl}\fi%
            \ifwl@first\global\wl@firstfalse\fi%
        }%
    \fi%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NEW v2.1.0 ---------------------->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \pgfspectrashade[type=<h|v>](start,end){name} ---> type: h-horizontal (default) | v-vertical
\def\pgfspectrashade{\ignorespaces\@ifnextchar[\wl@pgfspectrashade{\wl@pgfspectrashade[h]}}%
\def\wl@pgfspectrashade[#1](#2,#3)#4{\ignorespaces%
\ifnum#2>#3\relax\PackageError{pgf-spectra}%
{in \textbackslash pgfspectrashade the starting wavelength (#2) must be lesser then the finishing wavelength (#3)}%
{Try typing the wavelengths in the correct order: \textbackslash pgfspectrashade(#3,#2)...}\else%
\ifnum#3<381\relax\PackageError{pgf-spectra}{in \textbackslash pgfspectrashade the finishing wavelength (#3) must be at least 381...}%
{Please type a finishing wavelength greater then 380...}\else%
\ifnum#2<380\relax\def\wl@shade@begin{380}\else\pgfmathparse{int(#2)}\edef\wl@shade@begin{\pgfmathresult}\fi%
\ifnum#3>780\relax\def\wl@shade@end{780}\else\pgfmathparse{int(#3)}\edef\wl@shade@end{\pgfmathresult}\fi%
\pgfmathparse{(\wl@shade@end-\wl@shade@begin)/50}\edef\wl@shadecolor@step{\pgfmathresult}%
%\foreach \n in {1,...,51}{%
\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
\pgfmathparse{\wl@shade@begin+(\n-1)*\wl@shadecolor@step}\edef\wl@currentwl{\pgfmathresult}%
\wlcolor{\wl@currentwl}%
\edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%%
}%
\def\wl@test{#1}\def\wl@v{v}\def\wl@h{h}%
\ifx\wl@test\wl@h\relax%
% the horizontal pgfshading
\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)}%
\else\ifx\wl@test\wl@v\relax%
% the vertical pgfshading
\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)}%
\fi\fi%
\fi\fi%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pgfkeys{/wl/.cd,%
shade end/.get=\wl@shadeend,%
shade end/.store in=\wl@shadeend,%
shade end/.default=780,%
shade opacity/.get=\wl@shade@opacity,%
shade opacity/.store in=\wl@shade@opacity,%
shade opacity/.default=1,%
shade opacity color/.get=\wl@shade@opacitycolor,%
shade opacity color/.store in=\wl@shade@opacitycolor,%
shade opacity color/.default=white%
}%
\pgfkeys{/wl/.cd,shade end,shade opacity,shade opacity color}%
% \pgfspectraplotshade{name} or
% \pgfspectraplotshade[options]{name}
\def\pgfspectraplotshade{\@ifnextchar[\wl@pgfspectraplotshade{\wl@pgfspectraplotshade[]}}%
\def\wl@pgfspectraplotshade[#1]#2{\ignorespaces%
\pgfkeys{/wl/.cd,shade end=780,shade opacity=1,shade opacity color=white}%
\pgfkeys{/wl/.cd,UVcolor=wlUVcolor,IRcolor=wlIRcolor,gamma=.8}%
\pgfkeys{/wl/.cd,#1}%
\pgfmathparse{100*\wl@shade@opacity}\edef\@wl@shade@opacity{\pgfmathresult}%
%
% x[bp]=25+(380+8*(\n-1))*(50/\wl@shadeend)
%
\edef\wl@shadeend@pt{\wl@shadeend pt}%
\ifdim\wl@shadeend@pt<381pt\relax%
\PackageError{pgf-spectra}{shade end must be greater then 380}{Type a wavelength greater then 380}%
\else%
\pgfkeys{/pgf/number format/.cd,fixed,precision=4,set thousands separator={},assume math mode=true}%
\pgfmathparse{25+379.9/\wl@shadeend*50}%
\pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
\edef\xO{\wl@X@tmp bp}%
\ifdim\wl@shadeend@pt<780pt\relax%
\pgfkeys{/pgf/number format/.cd,fixed,precision=3,set thousands separator={},assume math mode=true}%
\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
\pgfmathparse{380+(\n-1)*(\wl@shadeend/50-7.6)}\edef\wl@currentwl{\pgfmathresult}%
\wlcolor{\wl@currentwl}%
\colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
\edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%%
\pgfmathparse{24+380/\wl@shadeend*50+\n-380/\wl@shadeend*\n+380/\wl@shadeend}%
\pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
\expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
}%
\pgfkeys{/pgf/number format/.cd,fixed,precision=4,set thousands separator={},assume math mode=true}%
\pgfmathparse{25+(\wl@shadeend+.1)/\wl@shadeend*50}%
\pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
\edef\xF{\wl@X@tmp bp}%
\else%
\pgfkeys{/pgf/number format/.cd,fixed,precision=3,set thousands separator={},assume math mode=true}%
\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
\pgfmathparse{380+(\n-1)*8}\edef\wl@currentwl{\pgfmathresult}%
\wlcolor{\wl@currentwl}%
\colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
\edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%%
\pgfmathparse{25+380/\wl@shadeend*50+400/\wl@shadeend*\n-400/\wl@shadeend}%
\pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
\expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
}%
\pgfkeys{/pgf/number format/.cd,fixed,precision=2,set thousands separator={},assume math mode=true}%
\pgfmathparse{25+780.1/\wl@shadeend*50}%
\pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
\edef\xF{\wl@X@tmp bp}%
\fi% ifdim<780pt
% the horizontal shading
\pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(\xO)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
color(\xF)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}
\fi% ifdim<381pt
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \pgfspectraplotmap[<l|h>]{name}
% l -> low resolution (51 colors -> 380 to 780 nm ; step 8 nm) ! Default
% h -> high resolution (401 colors -> 380 to 780 nm ; step 1 nm)
\def\pgfspectraplotmap{\ignorespaces\@ifnextchar[\wl@pgfspectraplotmap{\wl@pgfspectraplotmap[l]}}%
\def\wl@pgfspectraplotmap[#1]#2{\ignorespaces%
\def\wl@test{#1}\def\wl@l{l}\def\wl@h{h}%
\ifx\wl@test\wl@l\relax%
\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
\pgfmathparse{380+(\n-1)*8}\edef\wl@currentwl{\pgfmathresult}%
\wlcolor{\wl@currentwl}%
\edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%%
}%
% the pgfplots colormap
\pgfplotsset{/pgfplots/colormap={#2}{color(0bp)=(wlshcolI); color(1bp)=(wlshcolII); color(2bp)=(wlshcolIII); color(3bp)=(wlshcolIV); color(4bp)=(wlshcolV); color(5bp)=(wlshcolVI); color(6bp)=(wlshcolVII); color(7bp)=(wlshcolVIII); color(8bp)=(wlshcolIX); color(9bp)=(wlshcolX); color(10bp)=(wlshcolXI); color(11bp)=(wlshcolXII); color(12bp)=(wlshcolXIII); color(13bp)=(wlshcolXIV); color(14bp)=(wlshcolXV); color(15bp)=(wlshcolXVI); color(16bp)=(wlshcolXVII); color(17bp)=(wlshcolXVIII); color(18bp)=(wlshcolXIX); color(19bp)=(wlshcolXX); color(20bp)=(wlshcolXXI); color(21bp)=(wlshcolXXII); color(22bp)=(wlshcolXXIII); color(23bp)=(wlshcolXXIV); color(24bp)=(wlshcolXXV); color(25bp)=(wlshcolXXVI); color(26bp)=(wlshcolXXVII); color(27bp)=(wlshcolXXVIII); color(28bp)=(wlshcolXXIX); color(29bp)=(wlshcolXXX); color(30bp)=(wlshcolXXXI); color(31bp)=(wlshcolXXXII); color(32bp)=(wlshcolXXXIII); color(33bp)=(wlshcolXXXIV); color(34bp)=(wlshcolXXXV); color(35bp)=(wlshcolXXXVI); color(36bp)=(wlshcolXXXVII); color(37bp)=(wlshcolXXXVIII); color(38bp)=(wlshcolXXXIX); color(39bp)=(wlshcolXL); color(40bp)=(wlshcolXLI); color(41bp)=(wlshcolXLII); color(42bp)=(wlshcolXLIII); color(43bp)=(wlshcolXLIV); color(44bp)=(wlshcolXLV); color(45bp)=(wlshcolXLVI); color(46bp)=(wlshcolXLVII); color(47bp)=(wlshcolXLVIII); color(48bp)=(wlshcolXLIX); color(49bp)=(wlshcolL); color(50bp)=(wlshcolLI)}}%
\else\ifx\wl@test\wl@h\relax%%
\pgfplotsset{/pgfplots/colormap={#2}{rgb(0bp)=(.3,0,.3); rgb(1bp)=(.3122,0,.3175); rgb(2bp)=(.3238,0,.335); rgb(3bp)=(.3349,0,.3525); rgb(4bp)=(.3453,0,.37); rgb(5bp)=(.3552,0,.3875); rgb(6bp)=(.3645,0,.405); rgb(7bp)=(.3732,0,.4225); rgb(8bp)=(.3813,0,.44); rgb(9bp)=(.3889,0,.4575); rgb(10bp)=(.3958,0,.475); rgb(11bp)=(.4022,0,.4925); rgb(12bp)=(.408,0,.51); rgb(13bp)=(.4132,0,.5275); rgb(14bp)=(.4178,0,.545); rgb(15bp)=(.4219,0,.5625); rgb(16bp)=(.4253,0,.58); rgb(17bp)=(.4282,0,.5975); rgb(18bp)=(.4305,0,.615); rgb(19bp)=(.4322,0,.6325); rgb(20bp)=(.4333,0,.65); rgb(21bp)=(.4339,0,.6675); rgb(22bp)=(.4338,0,.685); rgb(23bp)=(.4332,0,.7025); rgb(24bp)=(.432,0,.72); rgb(25bp)=(.4302,0,.7375); rgb(26bp)=(.4278,0,.755); rgb(27bp)=(.4249,0,.7725); rgb(28bp)=(.4213,0,.79); rgb(29bp)=(.4172,0,.8075); rgb(30bp)=(.4125,0,.825); rgb(31bp)=(.4072,0,.8425); rgb(32bp)=(.4013,0,.86); rgb(33bp)=(.3949,0,.8775); rgb(34bp)=(.3878,0,.895); rgb(35bp)=(.3802,0,.9125); rgb(36bp)=(.372,0,.93); rgb(37bp)=(.3632,0,.9475); rgb(38bp)=(.3538,0,.965); rgb(39bp)=(.3439,0,.9825); rgb(40bp)=(.3333,0,1); rgb(41bp)=(.3167,0,1); rgb(42bp)=(.3,0,1); rgb(43bp)=(.2833,0,1); rgb(44bp)=(.2667,0,1); rgb(45bp)=(.25,0,1); rgb(46bp)=(.2333,0,1); rgb(47bp)=(.2167,0,1); rgb(48bp)=(.2,0,1); rgb(49bp)=(.1833,0,1); rgb(50bp)=(.1667,0,1); %
rgb(51bp)=(.15,0,1); rgb(52bp)=(.1333,0,1); rgb(53bp)=(.1167,0,1); rgb(54bp)=(.1,0,1); rgb(55bp)=(.0833,0,1); rgb(56bp)=(.0667,0,1); rgb(57bp)=(.05,0,1); rgb(58bp)=(.0333,0,1); rgb(59bp)=(.0167,0,1); rgb(60bp)=(0,0,1); rgb(61bp)=(0,.02,1); rgb(62bp)=(0,.04,1); rgb(63bp)=(0,.06,1); rgb(64bp)=(0,.08,1); rgb(65bp)=(0,.1,1); rgb(66bp)=(0,.12,1); rgb(67bp)=(0,.14,1); rgb(68bp)=(0,.16,1); rgb(69bp)=(0,.18,1); rgb(70bp)=(0,.2,1); rgb(71bp)=(0,.22,1); rgb(72bp)=(0,.24,1); rgb(73bp)=(0,.26,1); rgb(74bp)=(0,.28,1); rgb(75bp)=(0,.3,1); rgb(76bp)=(0,.32,1); rgb(77bp)=(0,.34,1); rgb(78bp)=(0,.36,1); rgb(79bp)=(0,.38,1); rgb(80bp)=(0,.4,1); rgb(81bp)=(0,.42,1); rgb(82bp)=(0,.44,1); rgb(83bp)=(0,.46,1); rgb(84bp)=(0,.48,1); rgb(85bp)=(0,.5,1); rgb(86bp)=(0,.52,1); rgb(87bp)=(0,.54,1); rgb(88bp)=(0,.56,1); rgb(89bp)=(0,.58,1); rgb(90bp)=(0,.6,1); rgb(91bp)=(0,.62,1); rgb(92bp)=(0,.64,1); rgb(93bp)=(0,.66,1); rgb(94bp)=(0,.68,1); rgb(95bp)=(0,.7,1); rgb(96bp)=(0,.72,1); rgb(97bp)=(0,.74,1); rgb(98bp)=(0,.76,1); rgb(99bp)=(0,.78,1); rgb(100bp)=(0,.8,1); %
rgb(101bp)=(0,.82,1); rgb(102bp)=(0,.84,1); rgb(103bp)=(0,.86,1); rgb(104bp)=(0,.88,1); rgb(105bp)=(0,.9,1); rgb(106bp)=(0,.92,1); rgb(107bp)=(0,.94,1); rgb(108bp)=(0,.96,1); rgb(109bp)=(0,.98,1); rgb(110bp)=(0,1,1); rgb(111bp)=(0,1,.95); rgb(112bp)=(0,1,.9); rgb(113bp)=(0,1,.85); rgb(114bp)=(0,1,.8); rgb(115bp)=(0,1,.75); rgb(116bp)=(0,1,.7); rgb(117bp)=(0,1,.65); rgb(118bp)=(0,1,.6); rgb(119bp)=(0,1,.55); rgb(120bp)=(0,1,.5); rgb(121bp)=(0,1,.45); rgb(122bp)=(0,1,.4); rgb(123bp)=(0,1,.35); rgb(124bp)=(0,1,.3); rgb(125bp)=(0,1,.25); rgb(126bp)=(0,1,.2); rgb(127bp)=(0,1,.15); rgb(128bp)=(0,1,.1); rgb(129bp)=(0,1,.05); rgb(130bp)=(0,1,0); rgb(131bp)=(.0143,1,0); rgb(132bp)=(.0286,1,0); rgb(133bp)=(.0429,1,0); rgb(134bp)=(.0571,1,0); rgb(135bp)=(.0714,1,0); rgb(136bp)=(.0857,1,0); rgb(137bp)=(.1,1,0); rgb(138bp)=(.1143,1,0); rgb(139bp)=(.1286,1,0); rgb(140bp)=(.1429,1,0); rgb(141bp)=(.1571,1,0); rgb(142bp)=(.1714,1,0); rgb(143bp)=(.1857,1,0); rgb(144bp)=(.2,1,0); rgb(145bp)=(.2143,1,0); rgb(146bp)=(.2286,1,0); rgb(147bp)=(.2429,1,0); rgb(148bp)=(.2571,1,0); rgb(149bp)=(.2714,1,0); rgb(150bp)=(.2857,1,0); %
rgb(151bp)=(.3,1,0); rgb(152bp)=(.3143,1,0); rgb(153bp)=(.3286,1,0); rgb(154bp)=(.3429,1,0); rgb(155bp)=(.3571,1,0); rgb(156bp)=(.3714,1,0); rgb(157bp)=(.3857,1,0); rgb(158bp)=(.4,1,0); rgb(159bp)=(.4143,1,0); rgb(160bp)=(.4286,1,0); rgb(161bp)=(.4429,1,0); rgb(162bp)=(.4571,1,0); rgb(163bp)=(.4714,1,0); rgb(164bp)=(.4857,1,0); rgb(165bp)=(.5,1,0); rgb(166bp)=(.5143,1,0); rgb(167bp)=(.5286,1,0); rgb(168bp)=(.5429,1,0); rgb(169bp)=(.5571,1,0); rgb(170bp)=(.5714,1,0); rgb(171bp)=(.5857,1,0); rgb(172bp)=(.6,1,0); rgb(173bp)=(.6143,1,0); rgb(174bp)=(.6286,1,0); rgb(175bp)=(.6429,1,0); rgb(176bp)=(.6571,1,0); rgb(177bp)=(.6714,1,0); rgb(178bp)=(.6857,1,0); rgb(179bp)=(.7,1,0); rgb(180bp)=(.7143,1,0); rgb(181bp)=(.7286,1,0); rgb(182bp)=(.7429,1,0); rgb(183bp)=(.7571,1,0); rgb(184bp)=(.7714,1,0); rgb(185bp)=(.7857,1,0); rgb(186bp)=(.8,1,0); rgb(187bp)=(.8143,1,0); rgb(188bp)=(.8286,1,0); rgb(189bp)=(.8429,1,0); rgb(190bp)=(.8571,1,0); rgb(191bp)=(.8714,1,0); rgb(192bp)=(.8857,1,0); rgb(193bp)=(.9,1,0); rgb(194bp)=(.9143,1,0); rgb(195bp)=(.9286,1,0); rgb(196bp)=(.9429,1,0); rgb(197bp)=(.9571,1,0); rgb(198bp)=(.9714,1,0); rgb(199bp)=(.9857,1,0); rgb(200bp)=(1,1,0); %
rgb(201bp)=(1,.9846,0); rgb(202bp)=(1,.9692,0); rgb(203bp)=(1,.9538,0); rgb(204bp)=(1,.9385,0); rgb(205bp)=(1,.9231,0); rgb(206bp)=(1,.9077,0); rgb(207bp)=(1,.8923,0); rgb(208bp)=(1,.8769,0); rgb(209bp)=(1,.8615,0); rgb(210bp)=(1,.8462,0); rgb(211bp)=(1,.8308,0); rgb(212bp)=(1,.8154,0); rgb(213bp)=(1,.8,0); rgb(214bp)=(1,.7846,0); rgb(215bp)=(1,.7692,0); rgb(216bp)=(1,.7538,0); rgb(217bp)=(1,.7385,0); rgb(218bp)=(1,.7231,0); rgb(219bp)=(1,.7077,0); rgb(220bp)=(1,.6923,0); rgb(221bp)=(1,.6769,0); rgb(222bp)=(1,.6615,0); rgb(223bp)=(1,.6462,0); rgb(224bp)=(1,.6308,0); rgb(225bp)=(1,.6154,0); rgb(226bp)=(1,.6,0); rgb(227bp)=(1,.5846,0); rgb(228bp)=(1,.5692,0); rgb(229bp)=(1,.5538,0); rgb(230bp)=(1,.5385,0); rgb(231bp)=(1,.5231,0); rgb(232bp)=(1,.5077,0); rgb(233bp)=(1,.4923,0); rgb(234bp)=(1,.4769,0); rgb(235bp)=(1,.4615,0); rgb(236bp)=(1,.4462,0); rgb(237bp)=(1,.4308,0); rgb(238bp)=(1,.4154,0); rgb(239bp)=(1,.4,0); rgb(240bp)=(1,.3846,0); rgb(241bp)=(1,.3692,0); rgb(242bp)=(1,.3538,0); rgb(243bp)=(1,.3385,0); rgb(244bp)=(1,.3231,0); rgb(245bp)=(1,.3077,0); rgb(246bp)=(1,.2923,0); rgb(247bp)=(1,.2769,0); rgb(248bp)=(1,.2615,0); rgb(249bp)=(1,.2462,0); rgb(250bp)=(1,.2308,0); %
rgb(251bp)=(1,.2154,0); rgb(252bp)=(1,.2,0); rgb(253bp)=(1,.1846,0); rgb(254bp)=(1,.1692,0); rgb(255bp)=(1,.1538,0); rgb(256bp)=(1,.1385,0); rgb(257bp)=(1,.1231,0); rgb(258bp)=(1,.1077,0); rgb(259bp)=(1,.0923,0); rgb(260bp)=(1,.0769,0); rgb(261bp)=(1,.0615,0); rgb(262bp)=(1,.0462,0); rgb(263bp)=(1,.0308,0); rgb(264bp)=(1,.0154,0); rgb(265bp)=(1,0,0); rgb(266bp)=(1,0,0); rgb(267bp)=(1,0,0); rgb(268bp)=(1,0,0); rgb(269bp)=(1,0,0); rgb(270bp)=(1,0,0); rgb(271bp)=(1,0,0); rgb(272bp)=(1,0,0); rgb(273bp)=(1,0,0); rgb(274bp)=(1,0,0); rgb(275bp)=(1,0,0); rgb(276bp)=(1,0,0); rgb(277bp)=(1,0,0); rgb(278bp)=(1,0,0); rgb(279bp)=(1,0,0); rgb(280bp)=(1,0,0); rgb(281bp)=(1,0,0); rgb(282bp)=(1,0,0); rgb(283bp)=(1,0,0); rgb(284bp)=(1,0,0); rgb(285bp)=(1,0,0); rgb(286bp)=(1,0,0); rgb(287bp)=(1,0,0); rgb(288bp)=(1,0,0); rgb(289bp)=(1,0,0); rgb(290bp)=(1,0,0); rgb(291bp)=(1,0,0); rgb(292bp)=(1,0,0); rgb(293bp)=(1,0,0); rgb(294bp)=(1,0,0); rgb(295bp)=(1,0,0); rgb(296bp)=(1,0,0); rgb(297bp)=(1,0,0); rgb(298bp)=(1,0,0); rgb(299bp)=(1,0,0); rgb(300bp)=(1,0,0); %
rgb(301bp)=(1,0,0); rgb(302bp)=(1,0,0); rgb(303bp)=(1,0,0); rgb(304bp)=(1,0,0); rgb(305bp)=(1,0,0); rgb(306bp)=(1,0,0); rgb(307bp)=(1,0,0); rgb(308bp)=(1,0,0); rgb(309bp)=(1,0,0); rgb(310bp)=(1,0,0); rgb(311bp)=(1,0,0); rgb(312bp)=(1,0,0); rgb(313bp)=(1,0,0); rgb(314bp)=(1,0,0); rgb(315bp)=(1,0,0); rgb(316bp)=(1,0,0); rgb(317bp)=(1,0,0); rgb(318bp)=(1,0,0); rgb(319bp)=(1,0,0); rgb(320bp)=(1,0,0); rgb(321bp)=(.9913,0,0); rgb(322bp)=(.9825,0,0); rgb(323bp)=(.9738,0,0); rgb(324bp)=(.965,0,0); rgb(325bp)=(.9563,0,0); rgb(326bp)=(.9475,0,0); rgb(327bp)=(.9388,0,0); rgb(328bp)=(.93,0,0); rgb(329bp)=(.9213,0,0); rgb(330bp)=(.9125,0,0); rgb(331bp)=(.9038,0,0); rgb(332bp)=(.895,0,0); rgb(333bp)=(.8863,0,0); rgb(334bp)=(.8775,0,0); rgb(335bp)=(.8688,0,0); rgb(336bp)=(.86,0,0); rgb(337bp)=(.8513,0,0); rgb(338bp)=(.8425,0,0); rgb(339bp)=(.8338,0,0); rgb(340bp)=(.825,0,0); rgb(341bp)=(.8163,0,0); rgb(342bp)=(.8075,0,0); rgb(343bp)=(.7988,0,0); rgb(344bp)=(.79,0,0); rgb(345bp)=(.7813,0,0); rgb(346bp)=(.7725,0,0); rgb(347bp)=(.7638,0,0); rgb(348bp)=(.755,0,0); rgb(349bp)=(.7463,0,0); rgb(350bp)=(.7375,0,0); %
rgb(351bp)=(.7288,0,0); rgb(352bp)=(.72,0,0); rgb(353bp)=(.7113,0,0); rgb(354bp)=(.7025,0,0); rgb(355bp)=(.6938,0,0); rgb(356bp)=(.685,0,0); rgb(357bp)=(.6763,0,0); rgb(358bp)=(.6675,0,0); rgb(359bp)=(.6588,0,0); rgb(360bp)=(.65,0,0); rgb(361bp)=(.6413,0,0); rgb(362bp)=(.6325,0,0); rgb(363bp)=(.6238,0,0); rgb(364bp)=(.615,0,0); rgb(365bp)=(.6063,0,0); rgb(366bp)=(.5975,0,0); rgb(367bp)=(.5888,0,0); rgb(368bp)=(.58,0,0); rgb(369bp)=(.5713,0,0); rgb(370bp)=(.5625,0,0); rgb(371bp)=(.5538,0,0); rgb(372bp)=(.545,0,0); rgb(373bp)=(.5363,0,0); rgb(374bp)=(.5275,0,0); rgb(375bp)=(.5188,0,0); rgb(376bp)=(.51,0,0); rgb(377bp)=(.5013,0,0); rgb(378bp)=(.4925,0,0); rgb(379bp)=(.4838,0,0); rgb(380bp)=(.475,0,0); rgb(381bp)=(.4663,0,0); rgb(382bp)=(.4575,0,0); rgb(383bp)=(.4488,0,0); rgb(384bp)=(.44,0,0); rgb(385bp)=(.4313,0,0); rgb(386bp)=(.4225,0,0); rgb(387bp)=(.4138,0,0); rgb(388bp)=(.405,0,0); rgb(389bp)=(.3963,0,0); rgb(390bp)=(.3875,0,0); rgb(391bp)=(.3788,0,0); rgb(392bp)=(.37,0,0); rgb(393bp)=(.3613,0,0); rgb(394bp)=(.3525,0,0); rgb(395bp)=(.3438,0,0); rgb(396bp)=(.335,0,0); rgb(397bp)=(.3263,0,0); rgb(398bp)=(.3175,0,0); rgb(399bp)=(.3088,0,0); rgb(400bp)=(.3,0,0); %
}}%
\fi\fi%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \pgfspectrarainbow[<tikz options>](<rainbow fade>,<rainbow start>,<rainbow knock out>,<rainbow background>,<rainbow transparency>){radius}
% tikz options -> color, opacity,scope fading
% rainbow clip -> applies a scope fading in clipped region
% ...
\pgfkeys{/wl/.cd,%
rainbow fade/.get=\wl@rainbowfade,%
rainbow fade/.store in=\wl@rainbowfade,%
rainbow fade/.default={},%
rainbow start/.get=\wl@rainbow@start,%
rainbow start/.store in=\wl@rainbow@start,%
rainbow start/.default=.6,% -> 60%
rainbow knock out/.get=\wl@rainbow@KO,%
rainbow knock out/.store in=\wl@rainbow@KO,%
rainbow knock out/.default=.4,% -> 40%
rainbow background/.get=\wl@rainbowback,%
rainbow background/.store in=\wl@rainbowback,%
rainbow background/.default=white,%
rainbow transparency/.get=\wl@rainbowtransp,%
rainbow transparency/.store in=\wl@rainbowtransp,%
rainbow transparency/.default=0}% -> 0%
%
\def\pgfspectrarainbow{\ignorespaces\@ifnextchar[\pgf@spectrarainbow{\pgf@spectrarainbow[]}}%
\def\pgf@spectrarainbow[#1]{\ignorespaces\@ifnextchar({\pgf@spectra@rainbow{#1}}{\pgf@spectra@rainbow{#1}()}}%
%
\def\pgf@spectra@rainbow#1(#2)#3{\ignorespaces%
\pgfkeys{/wl/.cd,rainbow fade,rainbow start,rainbow knock out,rainbow background,rainbow transparency}%
\pgfkeys{/wl/.cd,#2}%
\pgfmathparse{100-\wl@rainbowtransp*100}\edef\wl@rainbow@transp{\pgfmathresult}%
\pgfmathparse{\wl@rainbowtransp*100}\edef\wl@rainbow@transp@w{\pgfmathresult}%
\edef\wl@rainbowend{.8875cm}\pgfmathparse{\wl@rainbow@start*\wl@rainbowend/1cm}\edef\wl@rainbowstart{\pgfmathresult cm}%
\pgfmathparse{\wl@rainbow@KO*#3/1cm}\edef\wl@rainbowKO{\pgfmathresult cm}%%\edef\wl@rainbowKO{\wl@rainbow@KO cm}%
\ifdim\wl@rainbowstart<\wl@rainbowend\relax%
\ifdim\wl@rainbowstart<.0175cm\relax\edef\wl@rainbowstart{.0175cm}\fi% ensuring there is no error in radial shading
\pgfkeys{/pgf/number format/.cd,fixed,precision=3,set thousands separator={},assume math mode=true}%
\pgfmathparse{\wl@rainbowstart-1/50*(\wl@rainbowend-\wl@rainbowstart)}%
\pgfmathprintnumberto{\pgfmathresult}{\wl@rainbowresult}%
\edef\rO{\wl@rainbowresult pt}%
\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
\pgfmathparse{380+(\n-1)*8}\edef\wl@currentwl{\pgfmathresult}%
\wlcolor{\wl@currentwl}%
\edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor!100!transparent!\wl@rainbow@transp}%
\pgfmathparse{\wl@rainbowstart+1/50*(\n-1)*(\wl@rainbowend-\wl@rainbowstart)}%
\pgfmathprintnumberto{\pgfmathresult}{\wl@rainbowresult}%
\expandafter\edef\csname r\@Roman\n\endcsname{\wl@rainbowresult pt}%
}%
\pgfdeclareradialshading{pgfspectrarainbow}{\pgfpoint{0pt}{0pt}}{%
color(0cm)=(\wl@rainbowback!\wl@rainbow@transp@w!white);color(4/5*\rO)=(\wl@rainbowback!\wl@rainbow@transp@w!white!50);color(\rO)=(white);%
color(\rI)=(wlshcolI);color(\rII)=(wlshcolII);color(\rIII)=(wlshcolIII);color(\rIV)=(wlshcolIV);color(\rV)=(wlshcolV);color(\rVI)=(wlshcolVI);color(\rVII)=(wlshcolVII);color(\rVIII)=(wlshcolVIII);color(\rIX)=(wlshcolIX);color(\rX)=(wlshcolX);%
color(\rXI)=(wlshcolXI);color(\rXII)=(wlshcolXII);color(\rXIII)=(wlshcolXIII);color(\rXIV)=(wlshcolXIV);color(\rXV)=(wlshcolXV);color(\rXVI)=(wlshcolXVI);color(\rXVII)=(wlshcolXVII);color(\rXVIII)=(wlshcolXVIII);color(\rXIX)=(wlshcolXIX);color(\rXX)=(wlshcolXX);%
color(\rXXI)=(wlshcolXXI);color(\rXXII)=(wlshcolXXII);color(\rXXIII)=(wlshcolXXIII);color(\rXXIV)=(wlshcolXXIV);color(\rXXV)=(wlshcolXXV);color(\rXXVI)=(wlshcolXXVI);color(\rXXVII)=(wlshcolXXVII);color(\rXXVIII)=(wlshcolXXVIII);color(\rXXIX)=(wlshcolXXIX);color(\rXXX)=(wlshcolXXX);%
color(\rXXXI)=(wlshcolXXXI);color(\rXXXII)=(wlshcolXXXII);color(\rXXXIII)=(wlshcolXXXIII);color(\rXXXIV)=(wlshcolXXXIV);color(\rXXXV)=(wlshcolXXXV);color(\rXXXVI)=(wlshcolXXXVI);color(\rXXXVII)=(wlshcolXXXVII);color(\rXXXVIII)=(wlshcolXXXVIII);color(\rXXXIX)=(wlshcolXXXIX);color(\rXL)=(wlshcolXL);%
color(\rXLI)=(wlshcolXLI);color(\rXLII)=(wlshcolXLII);color(\rXLIII)=(wlshcolXLIII);color(\rXLIV)=(wlshcolXLIV);color(\rXLV)=(wlshcolXLV);color(\rXLVI)=(wlshcolXLVI);color(\rXLVII)=(wlshcolXLVII);color(\rXLVIII)=(wlshcolXLVIII);color(\rXLIX)=(wlshcolXLIX);color(\rL)=(wlshcolL);color(\rLI)=(wlshcolLI);%
color(.95cm)=(wlshcolLI)%
}%
\ifx\wl@rainbowfade\@empty\relax%
\tikz{\clip(-#3,\wl@rainbowKO) rectangle ++(2*#3,#3-\wl@rainbowKO);%
\fill[#1,shading=pgfspectrarainbow] (0,0) circle(#3);}%
\else%
\tikz{\clip[scope fading=\wl@rainbowfade] (-#3,\wl@rainbowKO) rectangle ++(2*#3,#3-\wl@rainbowKO);%
\fill[shading=pgfspectrarainbow,\wl@rainbowback,#1] (0,0) circle(#3);}%
\fi%
\else\PackageError{pgf-spectra}{invalid 'rainbow start' value (rainbow start=\wl@rainbow@start). The rainbow start should be greater or equal then 0 and lower then 1.}{Don´t forget that 'rainbow start' value is the fraction from witch the colors begin, relative to the center of a circle with radius 1...}%
\fi
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \tempercolor -> Convert a temperature in Kelvin to rgb color
%
% The original algorithm used in this macro can be found at
%
%                                    https://github.com/neilbartlett/color-temperature
%
% More information at...
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --------------------------------------------------------------------------------------------------------------
% https://tannerhelland.com/2012/09/18/convert-temperature-rgb-algorithm-code.html
%
% «Start with a temperature, in Kelvin, somewhere between 1000 and 40000.  (Other values may work,
% but I can't make any promises about the quality of the algorithm's estimates above 40000 K.)»
%                                                                                                                       Tanner Helland
% https://www.zombieprototypes.com/?p=210
%---------------------------------------------------------------------------------------------------------------
% and the improved algorithm at...
% --------------------------------------------------------------------------------------------------------------
% https://github.com/neilbartlett/color-temperature
%
% neilbartlett/color-temperature is licensed under the
%
% MIT License
% A short and simple permissive license with conditions only requiring preservation of copyright and license notices.
% Licensed works, modifications, and larger works may be distributed under different terms and without source code.
%
% Permissions
%      Commercial use, Modification,  Distribution,  Private use
% Limitations
%    Liability,  Warranty
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The MIT License (MIT)
%
% Copyright (c) 2015 Neil Bartlett
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without limitation the rights
% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
% copies of the Software, and to permit persons to whom the Software is
% furnished to do so, subject to the following conditions:
%
% The above copyright notice and this permission notice shall be included in
% all copies or substantial portions of the Software.
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
% THE SOFTWARE.
% © 2021 GitHub, Inc.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{tempercolor}{rgb}{0,0,0}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \tempercolor{Kelvin}
\def\tempercolor#1{\ignorespaces%
%Set Temperature = Temperature \ 100
\edef\wl@temperatura{#1sp}%
\ifdim\wl@temperatura>16380sp\relax% for supporting large values of T
\pgfkeys{/pgf/number format/.cd,fixed,precision=2,fixed zerofill,set thousands separator={},assume math mode=true}%
\pgfmathparse{#1sp/100sp*1.0026931+.002}% correction factor for the division made in sp
\pgfmathprintnumberto{\pgfmathresult}{\wl@T@tmp}%
\edef\wl@temperatura{\wl@T@tmp}%
\edef\wl@temperatura@pt{\pgfmathresult pt}%
\else%
\pgfmathparse{#1/100}%
\edef\wl@temperatura{\pgfmathresult}%
\edef\wl@temperatura@pt{\pgfmathresult pt}%
\fi%
\ifdim\wl@temperatura@pt<10pt\relax%
\PackageError{pgf-spectra}{tempercolor: the temperature must be at least 1000K}{Type a greater temperature...}%
\else\ifdim\wl@temperatura@pt>400pt\relax%
\PackageError{pgf-spectra}{tempercolor: the temperature must be at most 40000K}{Type a smaller temperature...}%
\else%
%Calculate Red:
\ifdim\wl@temperatura@pt>66pt\relax%
    \pgfmathparse{\wl@temperatura-55}\edef\wl@tempercolor@r{\pgfmathresult}%
    \pgfmathparse{351.976906+ 0.114207*\wl@tempercolor@r-40.253663*ln(\wl@tempercolor@r)}%
    \edef\wl@tempercolor@r{\pgfmathresult}%
    \edef\wl@tempercolor@r@pt{\pgfmathresult pt}%
    \ifdim\wl@tempercolor@r@pt<0pt\edef\wl@tempercolor@r{0}\relax\fi%
    \ifdim\wl@tempercolor@r@pt>255pt\edef\wl@tempercolor@r{255}\relax\fi%
    \pgfmathparse{\wl@tempercolor@r/255}\edef\wl@tempercolor@r{\pgfmathresult}%
\else%
    \edef\wl@tempercolor@r{1}%
\fi%
% Calculate Green:
\ifdim\wl@temperatura@pt>66pt\relax%
    \pgfmathparse{\wl@temperatura-50}\edef\wl@tempercolor@g{\pgfmathresult}%
    \pgfmathparse{325.449413+0.079435*\wl@tempercolor@g -28.085296*ln(\wl@tempercolor@g)}%
    \edef\wl@tempercolor@g{\pgfmathresult}%
    \edef\wl@tempercolor@g@pt{\pgfmathresult pt}%
    \ifdim\wl@tempercolor@g@pt<0pt\edef\wl@tempercolor@g{0}\relax\fi%
    \ifdim\wl@tempercolor@g@pt>255pt\edef\wl@tempercolor@g{255}\relax\fi%
    \pgfmathparse{\wl@tempercolor@g/255}\edef\wl@tempercolor@g{\pgfmathresult}%
\else%
    \pgfmathparse{\wl@temperatura-2}\edef\wl@tempercolor@g{\pgfmathresult}%
    \pgfmathparse{-155.254856-0.445970*\wl@tempercolor@g+104.492162*ln(\wl@tempercolor@g)}%
    \edef\wl@tempercolor@g{\pgfmathresult}%
    \edef\wl@tempercolor@g@pt{\pgfmathresult pt}%
    \ifdim\wl@tempercolor@g@pt<0pt\edef\wl@tempercolor@g{0}\relax\fi%
    \ifdim\wl@tempercolor@g@pt>255pt\edef\wl@tempercolor@b{255}\relax\fi%
    \pgfmathparse{\wl@tempercolor@g/255}\edef\wl@tempercolor@g{\pgfmathresult}%
\fi%
%Calculate Blue:
\ifdim\wl@temperatura@pt<66pt\relax%
    \ifdim\wl@temperatura@pt>20pt\relax%
    \pgfmathparse{\wl@temperatura-10}\edef\wl@tempercolor@b{\pgfmathresult}%
    \pgfmathparse{-254.769352+0.827410*\wl@tempercolor@b+115.679944*ln(\wl@tempercolor@b)}%
    \edef\wl@tempercolor@b{\pgfmathresult}%
    \edef\wl@tempercolor@b@pt{\pgfmathresult pt}%
    \ifdim\wl@tempercolor@b@pt<0pt\edef\wl@tempercolor@b{0}\relax\fi%
    \ifdim\wl@tempercolor@b@pt>255pt\edef\wl@tempercolor@b{255}\relax\fi%
    \pgfmathparse{\wl@tempercolor@b/255}\edef\wl@tempercolor@b{\pgfmathresult}%
    \else%
    \edef\wl@tempercolor@b{0}%
    \fi%
\else%
    \edef\wl@tempercolor@b{1}%
\fi%
\definecolor{wl@@tempercolor}{rgb}{\wl@tempercolor@r,\wl@tempercolor@g,\wl@tempercolor@b}%
\colorlet{tempercolor}{wl@@tempercolor}%
\fi\fi% check limits 1000K<T<40000K
}%
% <--- NEW v2.1.0 ------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% nm2rgb convert nanometre wavelength to rgb
% (380 <= Lambda <= 780 ) -> r,g,b on stack
%
% BASED on FORTRAN Code
% RGB VALUES FOR VISIBLE WAVELENGTHS by Dan Bruton (astro@tamu.edu)
% This program can be found at
% http://www.physics.sfasu.edu/astro/color.html
% and was last updated on February 20, 1996.
% The spectrum is generated using approximate RGB values for visible
% wavelengths between 380 nm and 780 nm.
% The red, green and blue values (RGB) are
% assumed to vary linearly with wavelength (for GAMMA=1).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newdimen\wl%wavelength
\newdimen\wl@i%intensity
\newdimen\@wl@gamma%gamma
\newdimen\wlc@lorr%red (0. - 1)
\newdimen\wlc@lorg%green (0. - 1)
\newdimen\wlc@lorb%blue (0. - 1) % wavelength to rgb values
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \wlcolor{wavelength}
\def\wlcolor#1{\ignorespaces%
\ifx\wl@bright\undefined\relax\def\wl@bright{100}\fi% NEW v2.1.0
\wl=#1pt%
\@wl@gamma=\wl@gamma pt%
% compute the rgb components
\ifdim\wl<10pt\relax\PackageWarning{pgf-spectra}{(#1nm) wavelength out of range ignored. The wavelength must be graeter or equal to 10nm (EUV)...}\else% NEW v2.0.0
\ifdim\wl<379.99999pt\relax\else%% NEW v2.0.0
\ifdim\wl<440pt\wlc@lorr=440pt\advance\wlc@lorr by-\wl\divide\wlc@lorr by60\wlc@lorg=0pt\wlc@lorb=1pt\else%
\ifdim\wl<490pt\wlc@lorr=0pt\wlc@lorg=\wl\advance\wlc@lorg by-440pt\divide\wlc@lorg by50\wlc@lorb=1pt\else%
\ifdim\wl<510pt\wlc@lorr=0pt\wlc@lorg=1pt\wlc@lorb=510pt\advance\wlc@lorb by-\wl\divide\wlc@lorb by20\else%
\ifdim\wl<580pt\wlc@lorr=\wl\advance\wlc@lorr by-510pt\divide\wlc@lorr by70\wlc@lorg=1pt\wlc@lorb=0pt\else%
\ifdim\wl<645pt\wlc@lorr=1pt\wlc@lorg=645pt\advance\wlc@lorg by-\wl\divide\wlc@lorg by65\wlc@lorb=0pt\else%
\ifdim\wl<780.00001pt\wlc@lorr=1pt\wlc@lorg=0pt\wlc@lorb=0pt\else%
\ifdim\wl>4000pt\relax\PackageWarning{pgf-spectra}{invalid wavelength (#1nm). The wavelength must be lesser or equal to 4000nm (NIR)...}% NEW v2.0.0
\relax%
\fi\fi\fi\fi\fi\fi\fi\fi\fi%
% intensity correction at vision limits
\ifdim\wl>700pt\ifdim\wl<780.00001pt\wl@i=780pt\advance\wl@i by-\wl\divide\wl@i by80\multiply\wl@i by7\advance\wl@i by3pt\divide\wl@i by10\fi\else%  NEW
\ifdim\wl<420pt\ifdim\wl>379.99999pt\wl@i=\wl\advance\wl@i by-380pt\divide\wl@i by40\multiply\wl@i by7\advance\wl@i by3pt\divide\wl@i by10\fi\else%
\wl@i=1pt%
\fi\fi%
%apply intensity at vision limits correction and  gamma
\ifdim\wl<380pt\colorlet{wl@temp}{\wl@UVcolor}\else\ifdim\wl>780pt\colorlet{wl@temp}{\wl@IRcolor}\else% NEW v2.0.0
\pgfmathparse{\wlc@lorr*\wl@i^\@wl@gamma}\edef\wl@red{\pgfmathresult}%
\pgfmathparse{\wlc@lorg*\wl@i^\@wl@gamma}\edef\wl@green{\pgfmathresult}%
\pgfmathparse{\wlc@lorb*\wl@i^\@wl@gamma}\edef\wl@blue{\pgfmathresult}%
\definecolor{wl@temp}{rgb}{\wl@red,\wl@green,\wl@blue}%
\fi\fi% NEW v2.0.0
\ifwl@usevisibleshade\relax% NEW v2.1.0
\colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}%
\else%
\colorlet{wlcolor}{wl@temp}%
\fi%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\wl@elt@search#1#2#3#4{\ignorespaces%
% #1 Chemical Symbol, entered by USER
% #2 Chemical Symbol to compare to, e.g. Na
% #3 Emission Lines Data (or error message)
% #4 Imax
\edef\wl@CS@user{#1}\edef\wl@CS@comp{#2}\relax% New
\ifx\wl@CS@user\wl@CS@comp\relax% New -> was \iftthenelse{...
\def\wl@elt@chemsym{#2}%  set chemical symbol
\def\wl@elt@elemdata{#3}%  set element lines data
\def\wl@elt@Imax{#4}%  set element Imax
\fi%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput