How to create animations from calexp cutout around the same star?

Hi all,
We are trying to get animated frame from different observations (calexp) corresponding to the same object in the sky (i.e. include some chosen coordinates).
As an example of what we want to do, you can think about the notebook tutorial 09 on how to extract the light curve of a variable star, but we want to use the image of the star in each individual calexp to create an animation of its variation - instead of just using the extracted magnitude.
We are able to obtain all the calexp exposures that include the given star at different epochs (this will of course include calexp with different ids and numbers of “visits” and “detector”). Then, in order to put them together and obtain a video, we need to align the different exposures - or more specifically some smaller cutout centred on the star.
In order to do so, I was hoping to use the task lsst.afw.math._warper, but I get an error, as this task wants sc=ExposureD as input, while the cutouts are sc=ExposureF, and I get an error (warpExposure(): incompatible function arguments. The following argument types are supported:
1. (destExposure: lsst.afw.image.exposure.ExposureD, srcExposure: lsst.afw.image.exposure.ExposureD, control: lsst.afw.math.WarpingControl, padValue: lsst.afw.image.pixel.SinglePixelD = <lsst.afw.image.pixel.SinglePixelD object at 0x7fae48d0eaf0>) → int).

Is there a way to still use the warper ? Or is there a better/simpler way to do interpolation of the cutouts in order to align them (and, for instance, co-add them)?

Thanks in advance for any suggestions or help :slight_smile:

Not necessarily the best solution to the full problem here, but if you want to just get types which are compatible, your calexp ExposureF has a .convertD() method which should allow you to pass it to the warper.

As for the animation itself, I regularly use ffmpeg to produce animations of static images. It’s not currently in the distribution, but I hope to have it added soon (though no guarantees about if/when), but in the meantime it should easily install on top of the stack with conda install ffmpeg -c conda-forge.

In addition to Merlin’s replies, you can also take a look at a StackClub notebook by Imran Hasan that shows how to make an animation from a set of images using matplotlib.animation: StackClub/Footprints.ipynb at master · LSSTScienceCollaborations/StackClub · GitHub
It runs at the IDF and will not require any additional package installs

This is a great use case and we are working on new tutorials to demonstrate how to efficiently get cutouts centered about an object of interest at various epochs for the upcoming DP0.2 release.

Hi @laura.inno, I did mark one of the responses in this thread as the solution, but please do respond to let us know if it was helpful to your situation?