Function Repository Resource:

ImportWavefrontRFL

Source Notebook

Import a Wavefront RFL file

Contributed by: Kevin Daily

ResourceFunction["ImportWavefrontRFL"][source]

imports the RFL data from source, returning a Blend Function.

ResourceFunction["ImportWavefrontRFL"]["rfl"]

reads the string "rfl" as RFL data.

ResourceFunction["ImportWavefrontRFL"][source,element]

imports the specified element of the source.

Details

The RFL file format was used by Wavefront's Advanced Visualizer software to store "spectral curve data", which is essentially a way to encode the response of a material to different wavelengths of light.
RFL files are plain-text, ASCII-encoded files.
Each data entry is a pair of numeric values. The first value is the wavelength of light hitting the material. The second value is the emitted intensity of that light.
ImportWavefrontRFL uses Import to first load the data from source as "Text", then parses the text for any materials.
The ImportWavefrontRFL source supports all of the same first arguments as Import.
If the source file cannot be located, then ImportWavefrontRFL parses the string rfl as if it were RFL data.
Elements supported by ImportWavefrontRFL include:
"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
The resulting Function is a Blend that takes a single argument, the wavelength of light in nanometers, and coverts it to an intensity level.
The Function is similar to ColorData["VisibleSpectrum"].

Examples

Basic Examples (5) 

Create a basic RFL file with a linear response to visible light:

In[1]:=
Export["example.rfl", "300 0\n700 1", "Text"]
Out[1]=

Import this RFL file as a Blend function:

In[2]:=
ResourceFunction["ImportWavefrontRFL"]["example.rfl"]
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"]]
Out[3]=

Import RFL text data stored via CloudPut:

In[4]:=
ResourceFunction["ImportWavefrontRFL"][
CloudObject[
 "https://www.wolframcloud.com/obj/kevind/WFR/example_rfl_1"]]
Out[4]=

Import an RFL file from a URL:

In[5]:=
ResourceFunction["ImportWavefrontRFL"][
 URL["https://raw.githubusercontent.com/KMDaily/WolframExamples/main/example_2.rfl"]]
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"]
Out[6]=

Scope (3) 

Import the text of an RFL file:

In[7]:=
ResourceFunction["ImportWavefrontRFL"]["300 0\n700 1", "Text"]
Out[7]=

Import an RFL file as the parsed data:

In[8]:=
ResourceFunction["ImportWavefrontRFL"]["300 0\n700 1", "Data"]
Out[8]=

Import the lines of an RFL file:

In[9]:=
ResourceFunction["ImportWavefrontRFL"]["300 0\n700 1", "Lines"]
Out[9]=

Applications (1) 

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"]]
Out[10]=

Publisher

Kevin Daily

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 09 August 2023

Source Metadata

Author Notes

The source material is almost impossible to find. The format is inferred from finding example files on the internet.

License Information