DifferentiableUniverseInitiative / GalFlow

A TensorFlow reimplementation of GalSim
MIT License
10 stars 4 forks source link

Adds affine transformations #5

Closed EiffL closed 3 years ago

EiffL commented 3 years ago

This PR aims to close #1 and adds the tools needed to implement affine transformations in TensorFlow, and to generate the transformation needed for shear. I've updated the following notebook with an example of how to use the new API. It essentially looks like this:

import galflow as gf
import tensorflow as tf

# It needs a batch and channel dimension
image = tf.zeros([1,256,256,1])
g1 = tf.zeros([1]) # Same batch dimension as the image
g2 = tf.zeros([1])

# And compute the sheared image
sheared_image = gf.shear(image, g1, g2)

image

Internally, I've added a few tools to handle generic affine transformations, this is going to be useful at some point when implementing WCS. I've used a matrix representation that allows for easy combination of different transformations into a new one.

EiffL commented 3 years ago

Ok so I checked :-) and it doesnt work if I remove tfa-nightly from the setup.py, because it's needed for tfg, and tfg doesnt install it.

EiffL commented 3 years ago

But, you have a point there :-) We need to have some tests to make sure things install and work correctly I'm gonna add one

EiffL commented 3 years ago

@b-remy I reviewed my own code, just to show you that my PR was below standards on a number of points :-) I'll fix them and maybe ask you to do a second round of reviews.

EiffL commented 3 years ago

Me closing documentations comments by saying we will fix it later with a specific documentation issue image