Coder Social home page Coder Social logo

raysect / source Goto Github PK

View Code? Open in Web Editor NEW
80.0 15.0 23.0 90.8 MB

The main source repository for the Raysect project.

Home Page: http://www.raysect.org

License: BSD 3-Clause "New" or "Revised" License

Python 80.02% Shell 0.03% Cython 19.96%
python raytracer framework scientific-computing science optics cython

source's Introduction

DOI Build Status

Raysect Logo

Raysect Python Raytracing Package

A ray-tracing framework for optical/non-optical physics simulations.

The aims of the Raysect project are as follows:

  • develop a ray-tracer that is easy for scientists and engineers to use and extend

  • the raytracer must be robust and high precision

The general development philosophy is ease of use trumps performance, but performance is not to be ignored.

For more information, see the documentation pages.

Dispersion of light passing through a prism

Caption: a simulation of Newton's classic experiment, white light being dispersed by a glass prism.

Please note, this code is currently under heavy development and subject to change.

Raysect currently only supports Linux. Windows support will come at a later stage.

Please note, for legal reasons we require the copyright to any contributed code to be passed to the Raysect project. Please see CONTRIBUTING.txt in the repository.

Development Team

  • Dr Alex Meakins
  • Dr Matthew Carr

Citing the Code

source's People

Contributors

cnlpepper avatar jacklovell avatar mateasek avatar mattngc avatar mkgessen avatar munechika-koyo avatar sorchard1 avatar vsnever avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

source's Issues

Add generic lens constructor for spherical singlets

Currently we have some smart lens builders with validators for the "planar" and "bi" lenses, four of the six fundamental spherical lenses. The meniscus lens are more dificult to validate because to degeneracy issues. Instead it would be better to have a general purpose lens constructor that can work for any spherical lens and performs simpler validation.

user question - diagnostic rays?

For a number of physics use cases, volume emission dominates over surface reflection effects and other possible light sources (i.e. a tokamak plasma). The emission model of a volume emitter can be very complicated, and interpreting the spectral output can sometimes be very difficult. A couple of times I have wanted to sample the properties of the emitting material during ray-tracing for latter analysis. In the case of a plasma for example, I wanted to log the temperature, density and magnitude of magnetic field at every ray evaluation point. This helps to understand the output spectra.

At the moment I have "hacked" this kind of functionality by putting an ndarray on the emitting material, and every time it is called by ray to evaluate its emitted spectra, I log the coordinates and local parameter values. Is there a cleaner way to do this?

Raysect needs a logo

Raysect needs a proper logo. Then this logo can be used in the documentation pages and on github, etc.

Orthogonal projection camera

A useful feature would be a built in orthogonal projection camera, which fires parallel rays from a regular grid of sources and return a grid of pixels. This would allow to have a schematic view of the world and to avoid perspective effects unlike the pinhole camera. Moreover there is almost nothing to change from the pinhole camera to get it.

Add sample method to ray

Because ray tracer is a path tracer, you get a different path, each time you sample. Need to add a sample() method to ray that can launch N sample paths and average their spectra.

Create readthedocs account for raysect

Create a readthedocs account for raysect. Post the initial api documentation. Layout the basic structure. Start a process for updating the documentation and adding examples.

Create a library module

Create a library module in optical that contains predefined materials, spectra and observers.

Example items for the library:

  • glasses from a manufacturer such as schott
  • metals such as Gold, Silver, Carbon etc...
  • observers that model a real CCD or camera
  • spectra and spectral functions such as CIE XYZ curves, black body radiation etc...

The core materials from which these are derived e.g. conductor, dielectric etc... that require data before use will remain in the material folder. Similarly the observer components and generic CCD objects (when created) will remain in observers.

Demo reel

Make a demo reel of pretty pictures plus raysect's feature highlights.
Post on youtube.

Add basic tools for aspheric lenses

Select a basic set of aspheric lenses from the thorlabs catalog. Implement both a general purpose constructor and complementory catalog selector.

Add a material with basic colors

In order to quickly displays shapes, it would be useful to have a built in display material which is only made to see the shapes of primitives on the world. It could also implement a set of basic color (monochromatic to avoid calculation) or RGB colors so as to be able to tell the difference between different primitives.

Cache raysect meshes with generated kd-tree

Currently it takes a long time to process large meshes. In some cases, it can take as long as an hour to process all the mesh nodes and build the kd-tree. It would make sense to pre-process a mesh and save the python mesh representation with all its acceleration structures into a dedicated raysect mesh file format. This allows users to only process meshes when changes are made to the underlying mesh components. For routine ray-tracing with the same meshes, the meshes can quickly be re-loaded from the raysect mesh files.

Add Lambertian material

  • to begin reflection modelling we need primitives to be able to have diffuse reflections.
  • Lambertian material is the simplest diffuse surface. Will be the first of a number.

Add a spectral configuration class

Passing these in as arguments occurs in many places throughout the code:

  • min wavelength
  • max wavelength
  • number of samples

Encapsulating them in a class in raysect.optical will simplify code.

Integrated power on collection surface

It would be useful for demo/ITER to predict the power incident on machine surfaces. Could be implemented as a large pixel, or collection of large pixels with cosine weighted hemispherical sampling.

Rework optical.material libraries

Expose materials as classes derived from their core material e.g. Gold(Conductor).

library.glass.Schott("N-BK7")
library.dielectric.Water(temperature=20.0)
library.plastic....
library.filter.....
library.metal.Gold

Vectored Camera

Some applications will require raysect to use a camera defined by an external party. For example, the camera may have already been calibrated in terms of its distortion and spatial properties. One option is to make a Camera class where every pixel maps to a sight line vector. The array of vectors can be supplied by the user. Another option is to specify a camera in terms of its optics, i.e. lens types, focal length, etc. But this will be left to a later date.

Diagnostic Ray

Create a ray for diagnostic purposes. Ideally it would enable visualisation of the ray path in the scene. For example, see the path of a ray through a dispersive element, such as a lens.

EncapsulatedPrimitive class

We need a primitive base class that can be used to encapsulate other primitives and hide their attributes from the user. The use case for this is to allow developers to assemble CSG objects and protect their internal structure from user interaction. Examples: biconvex lens primitive - can easily be constructed using basic primitives and CSG. The user should not interact with the components directly, instead the lens specific attributes should be used e.g. focal length or width.

class Biconvex(EncapsulatedPrimitive):
etc...

The class will need to contain a scenegraph that forwards geometry modifications to the primary scenegraph containing the EncapsulatedPrimitive (as occurs for the CSG primitives... generalise?)

Form a new raysect.primitive.utility package?

Convert Dielectric attenuation to extinction

To be consistent with the Conductor() object it would make sense to convert the Dielectric material to accept attenuation definition in terms of extinction, a utility function can be provided to handle attenuation coefficients (Special SpectralFunction that applies the conversion)

Document every core class

Try to do an initial pass of documentation on all core classes. Check them with Alex at the next sprint.

Support for a basic CAD format

  • pick a CAD format that is open and simple to support
  • enable a CAD file in that format to be loaded as a mesh primative

Basic mesh primative

  • allow meshes to be used as a primative geometry type
  • useful for representing complex geometries, probably CAD generated parts

Basic LineOfSight Observer class

We already have a base class for cameras. We need an appropriate base class for line of sight observers such as optical fibres.

Documentation

Get documentation ready in time for PyCon UK. A number of smaller tickets will be created to represent this task.

Add a function transforming a direction vector into a rotation matrix

As the geometrical position of objects are sometimes defined through a couple position + direction, it can be nice to have a built in function calculating the rotation matrix needed to implement this kind of objects in the scenegraph. The solution matrix is the one transforming the z vector (because most of scenegraph objects are defined along the z vector) of the reference frame into the direction vector. One must be careful that there is an infinite number of solution matrix, as the direction vector define only two angles, the third one is up to the user.
This function would help a lot to place cameras or cylinders (for beams) for example.

Create modifier materials

Add materials that modify the intersection (e.g. perturb the surface normal) before passing the intersection on to an actual material class. We can then add support for height (bump) textures and rough surfaces - frosted glass, scratched metal etc...

Similarly modifier materials can modify the returned spectrum, this can be used to simulate surface coatings e.g. filters.

Create an examples/demos folder

Currently there is no where to store our demos. Would be nice if we could create a dedicated examples or demo folder for storing examples as we go with the development.

Design a set of component classes for observer construction

It would be useful to have a common set of classes to represent pixels, fibre optic tips etc...

e.g:
square pixel - launches rays that sample over acceptance cone and pixel surface
point pixel - launches rays that sample over an acceptance code

Then define a few acceptance cones classes - hemisphere, cone, delta function.

Can then easily build CCD observers etc...

Support initial Interpolator2DMesh

  • many scientific data problems will produce solutions on meshes, i.e. finite element analysis, non-linear PDEs, etc.
  • Allow user to import a mesh with data values attached.
  • kd-tree looks up nearest mesh triangle that contains test point
  • Barycentric Interpolation to get data values at that point.

Check v0.1 installer works as expected

Run "python setup.py install" on a clean environment, check the installer works, all tests work and demos can be run. This is the final step to complete before v0.1 can be officially tagged as ready for release.

Capture demos in a gallery folder

From now onwards, all demo pictures should be captured in a gallery folder inside the demos folder. An image .png should be accompanied by a demo script of the same name.

Rebuild kdTree for meshes

The kdTree needs to be rebuilt and optimised for meshes. Should be rebuilt such that it can support both meshes and other primitives. Optimised for speed, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.