Code to extract the PS1 data