Ciela-Institute / caustics

A gravitational lensing simulator for the machine learning era.
https://caustics.readthedocs.io
MIT License
22 stars 8 forks source link

Built-in source samplers #32

Open ConnorStoneAstro opened 1 year ago

ConnorStoneAstro commented 1 year ago

For prototyping it would be useful to have a caustic built-in system to sample reasonable source images. The github could store the PROBES sample and there could be a method in caustic to draw a random PROBES galaxy. This would download an HDF5 file (first time its called) with the PROBES sample, then randomly select one, and sample it at the desired resolution.

adam-coogan commented 1 year ago

I'd recommend using the functionality already built into torch for this kind of thing: in particular Datasets for storing the data and DataLoaders for iterating through the data in various ways. And actually, I've already written one for HDF5 files as well as PROBES and Illustris-specific datasets that should cover a fair chunk of what's needed.

The main missing piece compared to what you're suggesting is downloading functionality. For consistency, I'd take a look at the MNIST dataset in torchvision, which has an init argument indicating whether or not to download the dataset.