Garchupiter / Kraken-Optical-Simulator

Python - Exact ray tracing library
GNU General Public License v3.0
67 stars 15 forks source link

User Manual + define custom surface #7

Closed SamB034 closed 2 years ago

SamB034 commented 2 years ago

Hello Joel Herrera.

Thank you for your interesting ray tracer module. It seems easy to use and I like the 3D visualization feature.

I would like to use it to simulate the ray propagation through a user defined surface defined by a 2D edge profile. I'm trying to generate a surface object by revolution of a seed profile specified by a set of R,Z coordinates (back face is flat, front face is a revolution of a seed profile).

As basis, I started with the Examp_ExtraShape_Radial_Sine.py example.

Q1) Where is "the included user manual (KrakenOS_User_Manual.pdf)" ? Can't find it. : /

Q2) what is this "f" function ?

Q3) what is this E parameter ? you define a "coef" array whose first two value are non zero. What is that?

__

def f(x, y, E): r = np.sqrt(x x + y y) r = np.asarray(r) H = 2.0 np.pi r / E[0] z = np.sin(H) * E[1] return z

__

coef = np.zeros(360) coef[0] = 5 coef[1] = .5 ES = [f, coef] L1c.ExtraData = ES

Q4) I get that my custom surface must be given to L1c.ExtraData. But how ? What arguments does it take ?

Thanks for the additional info! Sam

SamB034 commented 2 years ago

Hello. I have found how to generate a custom surface profile by modifying the "f" function of the "Examp_ExtraShape_Radial_Sine.py" example:

def f(x, y, E):
    r = np.sqrt(x * x + y * y)
    r = np.asarray(r)
    xp = #your radial coordinate vector (defined globally, I don't know how to pass it to f as argument :( )
    fp = #your surface height value at the radial coordinate xp (defined globally)
    # I interpolate my surface datapoint with the "r" vector calculated above with what seems to be the x,y mesh grid
    height =  np.interp(r, xp, fp, left=None, right=None, period=None) 
    z = height # It returns the interpolated height evaluated at r for the mesh coordinate (x, y)
return z

Still the documentation need to be clarified (where is that PDF?) and code need a few more comments.

Kind regards

Garchupiter commented 2 years ago

El 30 ago 2022, a las 2:01, SamB034 @.***> escribió:

Hello. I have found how to generate a custom surface profile by modifying the "f" function of the "Examp_ExtraShape_Radial_Sine.py" example:

def f(x, y, E): r = np.sqrt(x x + y y) r = np.asarray(r) xp = #your radial coordinate vector fp = #your surface height value at the radial coordinate xp

I interpolate my surface datapoint with the "r" vector calculated above with what seems to be the x,y mesh grid

height =  np.interp(r, xp, fp, left=None, right=None, period=None) 
z = height # It returns the interpolated height evaluated at r for the mesh coordinate (x, y)

return z Still the documentation need to be clarified (where is that PDF?) and code need a few more comments.

Kind regards

— Reply to this email directly, view it on GitHub https://github.com/Garchupiter/Kraken-Optical-Simulator/issues/7#issuecomment-1231376570, or unsubscribe https://github.com/notifications/unsubscribe-auth/AED73RV23LAMNC374CHFVYDV3XEW7ANCNFSM57TV5R6Q. You are receiving this because you are subscribed to this thread.

Hi SamB034

Apparently the last time I uploaded the files to github I forgot the folder with the documentation, the user manual in English still requires a lot of work, now I have included in github a manual that I have in Spanish that could be useful for the moment while I continue the appropriate documentation is prepared in English. If you still have any specific questions please do not hesitate to write me.

Cheers Joel Herrera V.

SamB034 commented 2 years ago

Hello Joel. Thank you for the user manual. I see it is richly illustrated and covers in length the use of the features offered by your library. If you like some help for the translation, you can consider to upload an editable document of the spanish and the english version

Kind regards Samuel