Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Import a Wavefront RFL file
| ResourceFunction["ImportWavefrontRFL"]["rfl"] reads the string "rfl" as RFL data. | |
| ResourceFunction["ImportWavefrontRFL"][source,element] imports the specified element of the source. | 
| "Elements" | a list of supported element names | 
| "Text" | the raw text from the file including any comments | 
| "Lines" | the raw text StringSplit by newlines | 
| "Data" | list of tuples of the wavelength of light and an intensity | 
| "Blend" | (default) a Function of a Blend expression | 
Create a basic RFL file with a linear response to visible light:
| In[1]:= | ![Export["example.rfl", "300 0\n700 1", "Text"]](https://www.wolframcloud.com/obj/resourcesystem/images/0bc/0bc800be-e8af-4686-a5e8-56c2f50e82aa/37a6886cc73afdbb.png) | 
| Out[1]= |  | 
Import this RFL file as a Blend function:
| In[2]:= | ![ResourceFunction["ImportWavefrontRFL"]["example.rfl"]](https://www.wolframcloud.com/obj/resourcesystem/images/0bc/0bc800be-e8af-4686-a5e8-56c2f50e82aa/7b7bef18995821f2.png) | 
| Out[2]= |  | 
Import an RFL file stored as a CloudObject:
| In[3]:= | ![ResourceFunction["ImportWavefrontRFL"][
CloudObject[
 "https://www.wolframcloud.com/obj/kevind/WFR/example_rfl_3.rfl"]]](https://www.wolframcloud.com/obj/resourcesystem/images/0bc/0bc800be-e8af-4686-a5e8-56c2f50e82aa/4d63e1f7387d9745.png) | 
| Out[3]= |  | 
Import RFL text data stored via CloudPut:
| In[4]:= | ![ResourceFunction["ImportWavefrontRFL"][
CloudObject[
 "https://www.wolframcloud.com/obj/kevind/WFR/example_rfl_1"]]](https://www.wolframcloud.com/obj/resourcesystem/images/0bc/0bc800be-e8af-4686-a5e8-56c2f50e82aa/34da6e3e106f3530.png) | 
| Out[4]= |  | 
Import an RFL file from a URL:
| In[5]:= | ![ResourceFunction["ImportWavefrontRFL"][
 URL["https://raw.githubusercontent.com/KMDaily/WolframExamples/main/example_2.rfl"]]](https://www.wolframcloud.com/obj/resourcesystem/images/0bc/0bc800be-e8af-4686-a5e8-56c2f50e82aa/0197a84fbba077ac.png) | 
| Out[5]= |  | 
Import a string that represents RFL data:
| In[6]:= | ![ResourceFunction[
 "ImportWavefrontRFL"]["!\n! Standard CIE D6500 illuminant\n! from:\n! Judd and Wyszecki\n! Color in Business, Science, and Industry\n! table 2.1 pp.108-109\n! normalized to approx 1.00 at 560nm\n!\n300 0.0003\n310 0.0330\n320 0.2020\n330 0.3710\n340 0.3990\n350 0.4490\n360 0.4660\n370 0.5210\n380 0.5000\n390 0.5460\n400 0.8280\n410 0.9150\n420 0.9340\n430 0.8670\n440 1.0490\n450 1.1700\n460 1.1780\n470 1.1490\n480 1.1590\n490 1.0880\n500 1.0940\n510 1.0780\n520 1.0480\n530 1.0770\n540 1.0440\n550 1.0400\n560 1.0000\n570 0.9630\n580 0.9580\n590 0.8870\n600 0.9000\n610 0.8960\n620 0.8770\n630 0.8330\n640 0.8370\n650 0.8000\n660 0.8020\n670 0.8230\n680 0.7830\n690 0.6970\n700 0.7160\n710 0.7430\n720 0.6160\n730 0.6990\n740 0.7510\n750 0.6360\n760 0.4640\n770 0.6680\n780 0.6340\n790 0.6430\n800 0.5950\n810 0.5200\n820 0.5740\n830 0.6030"]](https://www.wolframcloud.com/obj/resourcesystem/images/0bc/0bc800be-e8af-4686-a5e8-56c2f50e82aa/431c773939c5ee5e.png) | 
| Out[6]= |  | 
Import the text of an RFL file:
| In[7]:= | ![ResourceFunction["ImportWavefrontRFL"]["300 0\n700 1", "Text"]](https://www.wolframcloud.com/obj/resourcesystem/images/0bc/0bc800be-e8af-4686-a5e8-56c2f50e82aa/762bd1c8d1b17341.png) | 
| Out[7]= |  | 
Import an RFL file as the parsed data:
| In[8]:= | ![ResourceFunction["ImportWavefrontRFL"]["300 0\n700 1", "Data"]](https://www.wolframcloud.com/obj/resourcesystem/images/0bc/0bc800be-e8af-4686-a5e8-56c2f50e82aa/38bb93559c48be6a.png) | 
| Out[8]= |  | 
Import the lines of an RFL file:
| In[9]:= | ![ResourceFunction["ImportWavefrontRFL"]["300 0\n700 1", "Lines"]](https://www.wolframcloud.com/obj/resourcesystem/images/0bc/0bc800be-e8af-4686-a5e8-56c2f50e82aa/6d34336f975f24b3.png) | 
| Out[9]= |  | 
Show the intensity plot of the imported data:
| In[10]:= | ![ArrayPlot[{Range[300, 900]}, ImageSize -> 400, AspectRatio -> 0.1, ColorFunctionScaling -> False, ColorFunction -> ResourceFunction["ImportWavefrontRFL"][
   "!\n! Standard CIE D6500 illuminant\n! from:\n! Judd and Wyszecki\n! Color in Business, Science, and Industry\n! table 2.1 pp.108-109\n! normalized to approx 1.00 at 560nm\n!\n300 0.0003\n310 0.0330\n320 0.2020\n330 0.3710\n340 0.3990\n350 0.4490\n360 0.4660\n370 0.5210\n380 0.5000\n390 0.5460\n400 0.8280\n410 0.9150\n420 0.9340\n430 0.8670\n440 1.0490\n450 1.1700\n460 1.1780\n470 1.1490\n480 1.1590\n490 1.0880\n500 1.0940\n510 1.0780\n520 1.0480\n530 1.0770\n540 1.0440\n550 1.0400\n560 1.0000\n570 0.9630\n580 0.9580\n590 0.8870\n600 0.9000\n610 0.8960\n620 0.8770\n630 0.8330\n640 0.8370\n650 0.8000\n660 0.8020\n670 0.8230\n680 0.7830\n690 0.6970\n700 0.7160\n710 0.7430\n720 0.6160\n730 0.6990\n740 0.7510\n750 0.6360\n760 0.4640\n770 0.6680\n780 0.6340\n790 0.6430\n800 0.5950\n810 0.5200\n820 0.5740\n830 0.6030"]]](https://www.wolframcloud.com/obj/resourcesystem/images/0bc/0bc800be-e8af-4686-a5e8-56c2f50e82aa/658e658c84120c1a.png) | 
| Out[10]= |  | 
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License