Replies: 2 comments 4 replies
-
Hello Abe, First, let me congratulate you on Optic Explorer. It is a beautifully rendered app, well organized, and very responsive to interactive actions. One has to work hard to make even a mediocre GUI; a well executed one such as Optic Explorer deserves kudos! As far as collaboration goes, I am happy to contribute to open source efforts to improve and widen the availability and capability of optical design tools. A couple of years ago, Bill Claff approached me with a diffractive optic modeling problem and we spent some time working thru examples and ultimately improved both of our codes. Thanks for reaching out and great work. |
Beta Was this translation helpful? Give feedback.
-
Here's a quick attempt at laying out the .roa json file structure. Please ask questions! ray-optics .roa json file specificationimport json
import json_tricks
import pprint #from rayoptics.environment import *
from pathlib import Path
from rayoptics.gui import roafile Use Sasian Triplet.roa as an examplefilename = 'Sasian Triplet.roa' file_contents = roafile.preprocess_roa(Path.cwd() / filename, roafile.module_repl_050) The .roa file is almost pure jsonAn exception is how IEEE inf and nan are encoded. json_inputs = json.loads(file_contents) ray-optics python object encodingray-optics uses the json_tricks package for serializing python objects. The json_tricks package provides dump() and load() functions that augment the default python object encoding in json by including object metadata. The default json encoding of a python object is to encode the python object's attributes as a json object. The json_tricks package encodes a python object as a json object consisting of the object metadata info ('instance_type') and the object 'attributes'. The dump() implementation recursively exports all of the object's attributes. Top level JSON object contains the optical model.The attributes of the optical_model include the submodels (sequential, paraxial, element, etc) pprint.pprint(json_inputs, indent=1, sort_dicts=False, depth=3)
Optical Model attributesThe optical model data has 3 sections:
json_opm = json_inputs['optical_model']['attributes']
pprint.pprint(json_opm, sort_dicts=False, depth=3)
The Sequential ModelOnly the json_sm = json_opm['seq_model']['attributes']
pprint.pprint(json_sm, sort_dicts=False, depth=2)
Surface encoding exampleNote the profile is encoded in a separate json object, json_opm['profile_dict']. The 'profile_id' attribute is a key to the actual profile, contained in the json_opm['profile_dict']. json_ifcs2 = json_sm['ifcs'][2]
pprint.pprint(json_ifcs2, sort_dicts=False, depth=3)
Gap encoding examplejson_gaps3 = json_sm['gaps'][3]
pprint.pprint(json_gaps3, sort_dicts=False, depth=6)
Optical Specjson_osp = json_opm['optical_spec']['attributes']
pprint.pprint(json_osp, sort_dicts=False, depth=1)
json_wvls = json_osp['spectral_region']['attributes']
pprint.pprint(json_wvls, sort_dicts=False, depth=2)
json_pupil = json_osp['pupil']['attributes']
pprint.pprint(json_pupil, sort_dicts=False, depth=3)
json_fov = json_osp['field_of_view']['attributes']
pprint.pprint(json_fov, sort_dicts=False, depth=2)
json_field2 = json_fov['fields'][2]
pprint.pprint(json_field2, sort_dicts=False, depth=2)
json_defocus = json_osp['defocus']['attributes']
pprint.pprint(json_defocus, sort_dicts=False, depth=1)
json_pm = json_opm['parax_model']['attributes']
pprint.pprint(json_pm, sort_dicts=False, depth=3)
json_profiles = json_opm['profile_dict']
pprint.pprint(json_profiles, sort_dicts=False, depth=3)
json_profile2 = json_profiles['5803189312']
pprint.pprint(json_profile2, sort_dicts=False, depth=3)
json_em = json_opm['ele_model']['attributes']
pprint.pprint(json_em, sort_dicts=False, depth=2)
json_pt = json_opm['part_tree']['attributes']
pprint.pprint(json_pt, sort_dicts=False, depth=3)
json_parts = json_opm['parts_dict']
pprint.pprint(json_parts, sort_dicts=False, depth=2)
json_part2 = json_parts['5803192672']
pprint.pprint(json_part2, sort_dicts=False, depth=6)
|
Beta Was this translation helpful? Give feedback.
-
Hi. At one point in a previous discussion, you stated:
"My current interest is in GUI tools for first order optical design. This is an area that hasn't been well explored, IMHO, and is an area I've long been interested in."
I've been working on a similar project called OpticExplorer (www.opticexplorer.com) which has a nice interactive GUI but is lacking in analytical capabilities. Here's an overview video:
https://opticexplorer.sharedigm.com/services/public/api/video?path=%2FShared%2FVideos%2FWelcome%20To%20OpticExplorer.mp4
I don't know if there's a way that we could work together. You can currently export .zmx files from OpticExplorer into RayOptics for analysis so that could provide RayOptics users with a loosely integrated form of GUI. OpticExplorer could potentially also export ".roa" files as well.
I frequently see a desire to have optical modeling and analysis tools that are more accessible than the commercial offerings but it's difficult for us as individual developers or small groups to take on this task. I find myself wondering if it might be more achievable through some sort of collaboration.
Cheers,
-abe.
OpticExplorer, http://www.opticexplorer.com
Beta Was this translation helpful? Give feedback.
All reactions