IES lamps in blender

Yafaray has include the IES data for fixture

so now we can use commercial fixture having the shape of the beam in a TXT file
which can be used by YAFARAY to shpe teh beam of light for the fixture

now i want to prepare a script allowing to view in blender the spec for a light fixture

Hope this will be usefull for some blender users in teh commerical envrionment

her eis an example of on type of data that can found in a specofic manufacturer
sorry for the name ( Free publicity ) but at the size theya re i don’t think it changes anything

here is IES data for one fixture model

IESNA:LM-63-1995
[TEST] LTL TEST NUMBER 06530
[DATE] 02-25-2002
[MANUFAC] CROUSE-HINDS
[LUMCAT] CPMV2W042/UNV
[LUMINAIRE] CAST ALUMINUM HOUSING, FORMED SEMI-SPECULAR ALUMINUM
[MORE] REFLECTOR, CLEAR PRISMATIC GLASS LENS.
[LAMP] ONE PHILIPS PL-T 42W/30/4P RATED AT 3200 LUMENS.
[BALLAST] ONE UNIVERSAL LIGHTING TECHNOLOGIES C2642UNVSE
[OTHER] MOUNTING: WALL
TILT=NONE
1 3200. 1.0 73 9 1 1 0.73 0.31 0.67
1.0 1.0 41.
0 2.5 5 7.5 10 12.5 15 17.5 20 22.5 25 27.5 30 32.5 35 37.5 40 42.5 45 47.5 50
52.5 55 57.5 60 62.5 65 67.5 70 72.5 75 77.5 80 82.5 85 87.5 90 92.5 95 97.5
100 102.5 105 107.5 110 112.5 115 117.5 120 122.5 125 127.5 130 132.5 135
137.5 140 142.5 145 147.5 150 152.5 155 157.5 160 162.5 165 167.5 170 172.5
175 177.5 180
0 22.5 45 67.5 90 112.5 135 157.5 180
133 138 150 166 179 186 203 224 240 254 270 283 294 305 311 328 343 360 374 386
400 406 410 415 416 416 425 418 410 393 360 342 334 326 317 311 302 301 299
279 253 242 229 213 197 179 158 138 113 91 73 64 59 55 49 48 39 37 32 27 22 19
14 14 13 6 6 4 1 0 0 0 0
133 138 147 163 180 190 206 227 250 270 286 301 317 328 337 346 358 377 392 409
430 445 455 456 454 451 458 460 454 438 413 396 384 376 358 343 328 317 310
289 267 250 234 215 193 170 145 121 102 79 67 61 57 50 47 40 37 31 26 22 19 15
15 11 6 6 4 0 0 0 0 0 0
133 139 146 159 175 193 209 223 241 263 283 299 312 321 326 337 336 344 350 353
359 360 363 362 356 352 346 341 337 332 326 323 320 318 314 307 303 298 290
275 260 241 220 196 172 145 118 100 83 72 64 57 55 48 46 40 35 31 24 22 21 15
14 8 6 4 1 0 0 0 0 0 0
133 138 144 152 162 175 191 208 224 238 250 260 269 280 287 294 301 314 321 336
351 363 376 382 389 395 397 401 400 398 392 385 376 365 354 340 328 312 291
266 241 218 197 175 151 132 115 101 91 84 78 73 64 55 48 39 35 30 27 23 20 14
9 7 3 2 0 0 0 0 0 0 0
133 138 139 147 152 159 168 175 183 192 199 205 211 217 220 228 230 236 236 239
244 245 245 244 238 236 227 221 212 204 191 178 170 160 148 137 125 114 103 90
75 62 52 44 36 30 25 23 22 17 14 14 15 13 10 8 8 6 6 6 6 6 4 2 1 0 0 0 0 0 0 0
0
133 134 138 143 147 150 154 152 150 147 145 138 132 124 113 103 88 80 69 61 55
48 42 39 38 34 30 30 30 28 25 22 22 22 21 18 16 13 15 13 15 14 13 11 9 8 7 7 6
7 6 6 5 5 4 4 3 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
133 131 137 138 134 130 120 108 94 80 69 56 46 39 31 30 29 28 23 22 23 21 17 14
15 13 9 8 6 7 6 6 6 5 5 4 4 2 3 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
133 129 130 129 119 105 92 77 62 49 39 32 31 28 22 23 17 13 14 8 7 8 4 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0
133 131 130 125 113 99 85 71 55 44 37 32 32 27 23 23 15 15 12 6 6 5 3 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0

soon should have a script to read this type of text file
and then began to work on showing it in a blender file

happy blendering

Ok, do you know how to use the IES file.
I mean, what is the meaning of all the numbers?
I guess they explain the beam power for a distance or something…
I’m looking to the IES file specifications, will post anything I found interresting…

Here is a debut of a reading class :


#!/usr/bin/env python
# -*- coding: UTF-8 -*-



### IES lamp file reader class
### Simonced - Help to the thread started by RickyBlender at
### http://blenderartists.org/forum/showthread.php?p=1508803#post1508803

import re
import pprint

class IESreader:

    #object constructor
    #==================
    def __init__(self, filePath_):
        
        #the data structure of the file readen
        self.data = {}
        
        try:
            for line in open(filePath_).readlines():
                line = line.strip()
                reg = re.match("\[(.*)\](.*)", line)
                #We found key / value datas?
                if reg:
                    key = reg.group(1)
                    data = reg.group(2)
                    self.data[key] = data.strip()
                else:
                    #todo, understanding the numbers structure before
                    print "Todo - technical data analys"
            
        except Exception as msg:
            print "Error reading the file..."
            print msg
        
    #Return one information from the data attribute
    #==============================================
    def get(self, field_):
        #Entry check to prevent error
        if(field_ in self.data):
            return self.data[field_]
        else:
            return None
    
    #debug method to simply check the content of data and other things
    #=================================================================
    def debug(self):
        pprint.pprint(self.data)
        
        
#entry point for single class test
if __name__=="__main__":
    test = IESreader("ies1.txt")
    
    #test.debug()
    print "LAMP : %s" % test.get("LAMP")

I need to find the numbers specifications now…

here is a description for one of IES standard

http://www.kxcad.net/autodesk/3ds_max/Autodesk_3ds_Max_9_Reference/ies_standard_file_format.html
this is format ies for 1991
which is not the latest which is 1995 i think

but this is not the last one i think !

as you saw in my first script the first 12 lines are general description for the fixture lamp ballast
manufacturer ect…
just looking at the line i think this is clear

now one important thing is the date on the first line this identify the format of the file
and the way to read it so this date has to be extracted and if it is 1995 like shown in txt file
then i have this file format see ling given earlier
but there may be other fromat that may come in futur

if anybody has some of the format please give us a site for the description of these other formats

i found the IESNA1995
http://lumen.iee.put.poznan.pl/kw/iesna.txt

Thanks

salutations

Good, but I got the first part.
The half part is a bit difficult to get, and the explanations are not so accurate.
Not easy.

PS : Carefull, you miss typed IES by UES in the title :wink:

I found a good documentation (I think), just have to try to understand it lol ^_^!

there are 4 parts for this little file

1 – the first line with at the end the date
this is iportant tog et the date cause there are several type of format function of the date
like 1986 1991 1995 and may be other in Europe area

2 - the label areas
some genenral comments and spec
this part end with the line Tilt

so i think may ahe to read the file more than one time to define the different area and format

3- a gen data line see pic this is line 10
right under the Tilt line
this contains 2 variables to define the Qty of vert and horiz data
this determines qty of data in TXT file

you got 73 vertical angles and 9 horizontal angles inf txt file check it out

in otherwords this determines the 2 loops necessary to split the data for the beam shape
but you have to read it first i think
anyway you think about it

4 - the data itself

sorry badnews my mistake but seems you cannot change the title !

does it make it clear - i hope

give me your ffeedback
Thanks

i think i found another problem here

the txt file is not formatted as it should be !

there was new lines created
in other word the lines are too short for some of the data

like the data for lumen at angles shoud be on one linge not 4 lines i think

i’ll read more the description and try to find what is the limit in lenght for each line!

#######################

http://www.ltblight.com/English.lproj/LTBLhelp/pages/iesformat.html
this page gives the description for the file format
now don’t worry about all the different format
use only Tilt = NONE this simplify it a lot
as shown in sample txt file for 1995
not certain which other format should be included like for the european continent?

The maximum length of any label / keyword line (including the {CR}{LF} terminating pair) is 82 characters.
The maximum length of any other line (including the {CR}{LF} terminating pair) is 132 characters.
so i’ll reformat the page widht to 132 if i can

for the last section

Candela Values (Identifier Lines 14 Through 17)
These lines enumerate the (floating point) candela values. There is one line for
each corresponding horizontal angle, and one candela value for each corresponding vertical angle.

problem here
the thing is that in the sample txt file there are 73 vertical values
so this require more than on line

###################################
Thanks

here is the 3 photometric type for IES
in a blend file
this show the angles in 3D and their range

type A if for autotmotive
light projected frontward

Type B is for flood light

type C is the most common and the fixture project the ligth downward

see pic

the last pic represent the data in a real ies viewer
the text is the same than in the Text file given at teh beginning
all the words are the same

Thanks

nice work :wink:

to change the thread title, edit the first post, and change the title :yes:

sorry for the title i got it

you have to go into advance mode and then you can change it

it is done

Thanks

Thank, I found the same link as the one you found.
I get better the values now, since you detailed the number line.
Ok, I guess the candela value is the “strengh” of the light beam for a given horizontal and vertical position?
I’ll update the reader about this infos.
The unit is not a problem, feet or meter. Does the candelas multiplier has to be applied to the candela values?

Once I’m sure, we’ll have a single array or points to add in the blender scene I think.
Just an idea, 'cause I don’t know the best way to represent that.

See you soon.

well you saw the polar diagram

that’s what i;m trying to redo in blender - 2D dwg

but i would also like to show it like a 3D dwg
see pic

and yes the fa tor you mentionne must be multiply but i can add this afterward

right is 's more to get the data in the lines and set some variables
and then be able to draw it in blender

do you think you’ll ahve another version this weekend may be ?

now i already have a GUI scrpt that might work with this
i can transfert this into a function this weekend

the first label lines - first 12 lines
but that the problem you need to read the keyword at teh beginning to know where it goes
cause there can be more then 12 lines

the only limit is the last line for the label which is the TILT line

so there is a need to detect specific keyword find all of the lines with this keyword
and make may be an array f string for each keyword

so it’s not necessarely limited to 12 lines it could 15 or 20 lines

it’s a difficult format to read cause it’s not like a specific format for each data
don’t now why they have not come up with a strict format for this!
and format depends on the shape of the beam

so lets begin with the simple example given
and later may be we can add some more function to it
but i have to find other ies file with new format to test theses

Thanks

Ok, nice idea, and I planned to make a representation in 3D, more difficult but more fun.
My script already deal with n linges of keywords, don’t worry.
The tilt Line is easy to match and the other lines too.
I have this experience in that, it’s kind of piece of cake :wink:
I’ll update this week end.

Hi, here you go, it’s the first working draft of the IES reader.
Carefull, I think your file doesn’t respect the specs, so I used this one instead :


IESNA:LM-63-1995      
[TEST]    ABC1234 ABC Laboratories
[MANUFAC]    Aardvark Lighting Inc.
[LUMCAT]    SKYVIEW 123-XYZ-abs-400
[LUMINAIRE]    Wide beam flood to be used without tilt
[LAMPCAT]    MH-400-CLEAR
[LAMP]    Metal Halide 400 watt
[BALLASTCAT]    Global 16G6031-17R
[BALLAST]    400W 277V MH
[MAINTCAT]    4
[OTHER]    This luminaire is useful as an indirect flood
[MORE]    and to reduce light pollution in down light
[MORE]    applications.
[SEARCH]    POLLUTION SPORTS INDIRECT
[BLOCK]     
[LUMCAT]    TENNISVIEW 123-XYZ-abc-400
[LUMINAIRE]    Wide beam flood for indirect applications.
[ENDBLOCK]     
TILT=INCLUDE     
1     
13     
0     15     30     45     60     75     90     105     120     135     150     165     180
1.0    .95    .94    .90    .88    .87    .98    .87    .88    .90    .94    .95    1.0
1    50000    1    5    3    1    1    .5    .6    0
1.0    1.0    495
0    22.5    45    67.5    90
0    45    90
10000    50000    25000    10000    5000
10000    35000    16000    8000    3000
10000    20000    10000    5000    1000

Took from the page that explains the file specs here :
http://www.ltblight.com/English.lproj/LTBLhelp/pages/iesformat.html

I simply assumed the data are all on the same line.
I’ll patch to handle the long lines separated on many lines soon.
I also only handle the LM-63-1995 spec for instance. Wrong parcing if other file specs used.
I’ll handle that soon too.


#!/usr/bin/env python
# -*- coding: UTF-8 -*-



### IES lamp file reader class
### Simonced - Help to the thread started by RickyBlender at
### http://blenderartists.org/forum/showthread.php?p=1508803#post1508803

### good format spec here : http://www.ltblight.com/English.lproj/LTBLhelp/pages/iesformat.html


import re
import pprint

class IESreader:

    #object constructor
    #==================
    def __init__(self, filePath_):
        
        #the data structure of the file readen
        self.data = {}
        
        #other specific attributes to be added as the unit, the type and the candela factor.
        self.version = ""
        self.multiplier = 0
        self.units_type = 0
        self.photometric_type = 0
        self.vertical_angles = 0
        self.horizontal_angles = 0
        
        
        try:
            #lines to be used in the loop
            
            #we start to count once the Title line is passed
            tilt_line_passed = False
            data_line_id = 0
                
            for line in open(filePath_).readlines():
                
                #header analys part
                #------------------
                if not tilt_line_passed:
                
                    #line = line.strip()    #may be needed for some lines, but not all
                    regKW = re.match("\[(.*)\](.*)", line)
                    regVer = re.match("IESNA:(.*)", line)
                    regTilt = re.match("TILT=(.*)", line)
                    
                    #We found key / value datas?
                    if regKW:
                        key = regKW.group(1)
                        data = regKW.group(2)
                        if key in self.data:
                            self.data[key] += ' '+data.strip()
                        else:
                            self.data[key] = data.strip()
                    elif regVer:
                        self.version = regVer.group(1).strip()
                    elif regTilt:
                        self.tilt = regTilt.group(1).strip()
                        tilt_line_passed = True
                    else:
                        #Nothing mathc for here?
                        print "Unreconized data"
                else:
                    #Start to analyse technical data
                    data_line_id += 1
                    
                    if data_line_id == 5:
                        data = line.strip().split()
                        self.multiplier = data[2]
                        self.vertical_angles = int(data[3])
                        self.horizontal_angles = int(data[4])
                        self.photometric_type = data[5]    # 1 feet, 2 meters
                        self.units_type = data[6]
                        
                        #preparing the angle array to insert datas
                        self.candela_values = [[0 for col in range(self.vertical_angles)] for row in range(self.horizontal_angles)]
                        
                    elif data_line_id >= 9 and data_line_id <= 9+ self.horizontal_angles:
                        #the candela values, fun part ;-)
                        #for the moment, let's say each line is full, and not cutsplitted on many sub lines
                        ix = data_line_id - 9
                        iy = 0
                        for value in line.split():
                            self.candela_values[ix][iy] = value
                            iy += 1
                        
                    else:
                        print "TODO data Analys... line %i" % data_line_id
            
        except Exception as msg:
            print "Error reading the file..."
            print msg
        
    #Return one information from the data attribute
    #==============================================
    def get(self, field_):
        #Entry check to prevent error
        if(field_ in self.data):
            return self.data[field_]
        else:
            return None
    
    #debug method to simply check the content of data and other things
    #=================================================================
    def debug(self):
        pprint.pprint(self.__dict__)
        
        
#entry point for single class test
#=================================
if __name__=="__main__":
    test = IESreader("ies2.txt")
    
    test.debug()
    #print "LAMP : %s" % test.get("LAMP")
    #print "version %s" % test.version

The script is going on.
I also know how to create the vertexes representing the mesh (still don’t know how to link the good vertexes to make the faces lol).
I started a simple script to create the mesh from the IES file.
But the coordinnates are in angles in the IES file, wich seems polar coordinates to me.
Does any body know how to translate it into x,y,z, coordinates?

Well, I suck in mathematics lol.

PS : forgot to add, how is oriented the coordinates in the IES file? if I refer to type C for example, it’s falling down no?
(I mean the horizontal 0 deg. angle is pointing up?)

for the angles depends if vert or horz

just put some equestions i’ll change it to the real thing
i know how to deal with polar not a prolem at all for me!

now one thing here not certain yet if the object for the data should be mesh or curve

or many curves - curves allow to set and extrud obejct to change the size of the lines
then allowing to see it better in color and you can print it also

any problem with curve + profile ?

now be carefull for the file i’v given to you
this is a real IES data file from a manufacturer - no name given here
i simply rename extension from IESm name at the end for TXT

but it’s a real file and should be readable

have you ever played with IES data’s before to do calculation of lighting for
proffessional commercial lighting project ?

i have 100’s of IES file i can sent you some if you want

Thanks

i ran the file and get an error that it cannot find the file

any idea why it;s not finding the file in current folder
like it was before?

i mean in the first file i used the command
f=open(‘ies1.txt’,‘r’) and it worked fine

don’t why is the new file read not working as well?

now will this read the data and put theses into an arrya from which we can read it and may be copy it into a curve object ?

also at which location do you do the calculations in script - what lines?

also can you print the data on the console to see it
this could be removed afteward

for the time being i would not go further then IES 1995
like the other std 1991 / 86 i mean theses are too old anyway and not in use anymore
what do you think?
any be wait to see if anybody needs theses later on!

the only usefull other one would be the european standard
do you have the page for description of this one?

but i don’t have an example ies file for theses ones
anybody can provide 2 or 3 sample files for theses?

i already have a good GUI for this
i can upload it unless you already have one
let me know if you want me to upload it ?

the only thing left is to add some buttons as needed
options like read file - 2Dwg - 3Dwg and other if required
may be print data or graphique if this can be done on printer or file
but i don’t know how to do that and there you could help a lot

Thanks

sorry i just saw in script that you use a new file as shown in earlier post

ies2.txt

but this one is with Tilt=“include” which is for flood ligth phorotmetric type B
this does not have the same shape as the first file
the photometric type is for flood light type B the first file was for type C
you can see the different type in post earlier
i can you sent to you the file migth be easeir to see the differet type

but can this read the Tilt=“none” like the first file ?

i did a test on first file
there is one error see pic
it should e able to read this type of file with Tilt=None
that’s a real ies file from a manufactuerer

it looks like the data or vert and horx where not read!
at least i don’t see it in the Console
also i don’t see the number of Vert and horz quantity of angles
is it possible to add it to the console and as variable it’s is neeeded anyway!

i also have rework the name for vars on line 10 see next pic
this show the var for angles vert and horz
which are requried for reading the datas

i mean i did think you were that far yet
very good work !

Thanks

I see, the ies2.txt I use is from the example on the documentation page, because it’s a 1995 revision format.
What I find ood on your file is that the candale specs and angles count are on the line next to TILT.
In the spec, it should be on the next few lines as here :


05    TILT={file-spec} or {INCLUDE} or {NONE}
06    {lamp-to-luminaire geometry}
07    {# of pairs of angles and multiplying factors}
08    {angles}
09    {multiplying factors}
10 {# of lamps} {lumens per lamp} {candela multiplier} {# of vertical angles} {# of horizontal angles} {photometric type} {units type} {width} {length} {height}

What disturbed me is that your file misses the lines 6,7,8,9.
Did I miss something?

I updated a bit the script and I only read the files with the header IESNA:LM-63-1995
In the ies2.txt I ignore the TILT=INCLUDE, and the photometric type is 1 (type C)
See the line #10 :
1 50000 1 5 3 1 1 .5 .6 0
No problem I think.

Here is the last version of the script.
You canm use the debug method to display the object and see what data we can manipulate.
I aslo added a function to extract a list of vertex coordinates in ortho, but not sure it works…
This is the function getOrthoCoords().
Here is the updated script.


#!/usr/bin/env python 
# -*- coding: UTF-8 -*- 

""" 
==========================
IES lamp file reader class 
==========================

Copyright November 2009 Simonced and RickyBlender

Thread started on Blenderartists.org at 
http://blenderartists.org/forum/showthread.php?p=1508803#post1508803 

Let us know on the blenderartists forum if you use this script and if you encounter any problems running it.

License :
---------
- For personnal use only
- Not for commercial use
- It would be nice to reference the authors of this script when using it
- Please do not change the Copyright statements in the script

External references:
--------------------
good format spec : http://www.ltblight.com/English.lproj/LTBLhelp/pages/iesformat.html
""" 
 
import re 
import pprint 
import math 
 
class IESreader: 
 
    #object constructor 
    #================== 
    def __init__(self, filePath_): 
         
        #the data structure of the file readen 
        self.data = {} 
         
        #other specific attributes to be added as the unit, the type and the candela factor. 
        self.version = "" 
        self.multiplier = 0 
        self.units_type = 0 
        self.photometric_type = 0 
        self.vertical_angles_count = 0 
        self.horizontal_angles_count = 0 
        self.vertical_angles = [] 
        self.horizontal_angles = [] 
         
        self.ready = False    #allows to make some data extractions and other.... 
         
        try: 
            #lines to be used in the loop 
             
            #we start to count once the Title line is passed 
            tilt_line_passed = False 
            data_line_id = 0 
                 
            for line in open(filePath_).readlines(): 
                 
                #header analys part 
                #------------------ 
                if not tilt_line_passed: 
                 
                    #line = line.strip()    #may be needed for some lines, but not all 
                    regKW = re.match("\[(.*)\](.*)", line) 
                    regVer = re.match("IESNA:(.*([0-9]{4}))", line) 
                    regTilt = re.match("TILT=(.*)", line) 
                     
                    #We found key / value datas? 
                    if regKW: 
                        key = regKW.group(1) 
                        data = regKW.group(2) 
                        if key in self.data: 
                            self.data[key] += ' '+data.strip() 
                        else: 
                            self.data[key] = data.strip() 
                    elif regVer: 
                        self.version = regVer.group(1).strip() 
                         
                        #On other files formats, we pass, only 1995 specs suported at the moment 
                        if regVer.group(2) != "1995": 
                            print "Error : Other file formats than 1995 are not handled" 
                            return 
                             
                    elif regTilt: 
                        self.tilt = regTilt.group(1).strip() 
                        tilt_line_passed = True 
                    else: 
                        #Nothing mathc for here? 
                        print "Unrecognized data" 
                else: 
                    #Start to analyse technical data 
                    data_line_id += 1 
                     
                    if data_line_id == 5: 
                        #mask = {# of lamps} {lumens per lamp} {candela multiplier} {# of vertical angles} {# of horizontal angles} {photometric type} {units type} {width} {length} {height} 
                        data = line.strip().split() 
                        self.multiplier = data[2] 
                        self.vertical_angles_count = int(data[3]) 
                        self.horizontal_angles_count = int(data[4]) 
                        self.photometric_type = data[5]    # 1 feet, 2 meters 
                        self.units_type = data[6] 
                         
                        #preparing the angle array to insert datas 
                        self.candela_values = [[0 for col in range(self.vertical_angles_count)] for row in range(self.horizontal_angles_count)] 
                     
                    elif data_line_id == 7: 
                        #vertical angles list 
                         
                        self.vertical_angles = line.strip().split() 
                         
                    elif data_line_id == 8: 
                        #horizontal angles list 
                         
                        self.horizontal_angles = line.strip().split() 
                         
                    elif data_line_id >= 9 and data_line_id <= 9+ self.horizontal_angles_count: 
                        #the candela values, fun part ;-) 
                         
                        #for the moment, let's say each line is full, and not cutsplitted on many sub lines 
                        ix = data_line_id - 9 
                        iy = 0 
                        for value in line.split(): 
                            self.candela_values[ix][iy] = value 
                            iy += 1 
                         
                        #since we may not need anymore datas, we can update the ready status 
                        self.ready = True 
                         
                    else: 
                        print "TODO data Analys... line %i" % data_line_id 
             
        except Exception as msg: 
            print "Error reading the file..." 
            print msg 
         
    #Return one information from the data attribute 
    #============================================== 
    def get(self, field_): 
        #Entry check to prevent error 
        if(field_ in self.data): 
            return self.data[field_] 
        else: 
            return None 
     
    #debug method to simply check the content of data and other things 
    #================================================================= 
    def debug(self): 
        pprint.pprint(self.__dict__) 
     
    #A function to extract the ortho coordinates for the candale angles and values
    #============================================================================= 
    def getOrthoCoords(self): 
         
        if not self.ready: 
            return None 
         
        #let's proceed 
        data = [] 
         
        hi, vi = 0, 0 
         
        for va in self.vertical_angles: 
            va = float(va) 
            hi = 0 
            for ha in self.horizontal_angles: 
                ha = float(ha) 
                cv = float(self.candela_values[vi][hi]) 
                 
                x = cv * math.sin(math.radians(va)) * math.cos(math.radians(ha)) 
                y = cv * math.sin(math.radians(va)) * math.sin(math.radians(ha)) 
                z = cv * math.cos(math.radians(va)) 
                vector = [x,y,z] 
                hi += 1 
                 
                data.append(vector) 
                 
            hi += 1 
         
        # all data should have been converted 
        return data 
         
#entry point for single class test 
#================================= 
if __name__=="__main__": 
    test = IESreader("ies2.txt") 
    test.debug() 
     
    print "File Analysed" 
     
    #once we have the file in memory, we can extract vertext x,y,z coordinates ;) 
    xyz = test.getOrthoCoords() 
     
    print xyz 
     
    #print "LAMP : %s" % test.get("LAMP") 
    #print "version %s" % test.version 

I dobn’t have any experience in the IES files, it’s totally new, but I like file parsing scripts :smiley:
Before I go further, can you validate me that this script displays the data and read the file from the focumentation?
It works on my side.

See you soon.

PS : I also started to create a mesh with the converted coordinates but I have a problem to include my script inside blender, I posted a question on the python parts of this forum.
If you or any body have any idea :wink: