Python script to select the corresponding reference files from the psql database for each of the new images (V0, V1 etc). This creates a text file in each of the diretories with columns: diffem ref new