Closed rmjarvis closed 10 years ago
Oooh. Tricky. :)
@JPBird Justin, I added you as a Galsim-developer. And it turns out we didn't have an open issue about this yet, so I made one, and assigned you to it. :) So this gives you a forum for posting questions you might have as you work on it. You can pose thoughts about the design, how best to incorporate it in Galsim, etc.
You've already got Galsim installed, so the next thing you should look at for some of our developer tips is the Galsim/devel/ directory. Specifically, credo.txt, git.txt, and doxygen_readme.txt. I'm not sure how well they've all been kept up to date over the past year, but at one point, they had all the relevant information you would need as a new developer. :) Of course, you can ask questions here if anything in there is confusing.
Hello there,
Thanks for the tips so far. To begin with, my flexion code is written in python, so I'll first apply that to the Galsim pipeline as an outside addition. Now, I see the draw routine produces a python array from a Galsim instance. Is there a straightforward way to clone a numpy array back into the instance where it would be converted to the c++ form that galsim uses?
My thoughts at this stage are to take the image created by galsim, convert to a python array, flex it, and convert back to the form galsim uses, to be further handled with the rest of the pipeline.
Any help would be appreciated. Thanks!
The draw routine creates a galsim.Image. You can get a numpy array directly out of that using, e.g.,
my_im = gsobject.draw(...)
my_arr = my_im.array
You can convert that back into a galsim imageview objecft using
my_new_im = galsim.ImageViewF(my_arr)
You may also need to set some of the image attributes using e.g., the setScale
routine.
Hello all,
Just updating this issue officially.
I have written an open-source Python module (which I call GalFlex) that simulates second-order weak gravitational lensing effects (flexion), along with shear and convergence, on simulated source images. It is self-contained, but can also integrate directly into GalSim. Because shear and flexion are noncommutative operations, my code also can simulate magnification and shear, with shear amounts/moments/etc. well-matching GalSim's methods.
The module is meant to provide a quick, easy, and intuitive user interface for simulating images from input catalogs or directly from a file. By keeping dependencies strictly in Python, GalFlex forgoes a building process, and does not have a complicated structure.
GalFlex operates in real-space, drawing a finely meshed matrix, and performing the second-order lensing effect based on input shear and flexion values. The images are represented in the form of a 2-dimensional, NxN Numpy array. These allow greater transparency in the heart of the code, with operations running almost as quickly as the equivalent C code.
I've uploaded a version (0.4) of my GalFlex flexion module on my webpage: http://physics.drexel.edu/~jbird/galflex/, along with a reference guide and updated examples.
Since there are no plans to integrate this into GalSim at this time, I'm closing this issue. We can always reopen later on if plans change.
Justin Bird (at Drexel) has been working on adding a module to implement flexion with Galsim objects. This issue is for him to incorporate that work into GalSim.