##############################################
#AJD May 16th 2023                           #
#                                            #
#Do not distribute without this Read Me file.#
##############################################

Details of the Zubercal data release parquet files.
====================================================================================

Zubercal photometry files are contained in directories that are divided by object RA. 
There is a separate directory for each half degree of RA. These are marked with 
four-digit directory number (which is RA*10 deg). For example, objects in the range: 
20 < RA < 20.5 deg are under F0200. Similarly, objects in the range: 
120.5 < RA < 121 deg are found under F1205. 
Here an object's RA is taken from the four digits in the PS1 ID that encodes 
it (i.e. ps1id[5:9]). The filename's RA digits are all "rounded down" to the nearest 
0.5 deg.

The parquet filenames within each directory include the same four-digit RA-part 
as well as a four digit Declination part and the ZTF filter used (e.g. g,r or i)
The declination also comes from the PS1 ID, where it is encoded as 
Dec = float(int(PS1ID[:5])*0.0083333)-90. 
As with the RA, the Decs contained within a parquet file are "rounded down"
to nearest 5 (for Dec < 60 deg), or nearest 10 (for Dec > 60 degs).
Thus, a Zubercal parquet file named "ztf_1310_1400_i.parquet" will contain
ZTF i-band photometry within the ranges: 131 < RA < 131.5 deg 
and 26.6662 < Dec < 27.0829 [i.e. (1400*0.083333)-90 < Dec < (1405*0.083333)-90]

The approximate RA and Dec limits of each file and filter are given in:
Zubercal_g.txt, Zubercal_r.txt, Zubercal_i.txt

==================================================================================
File details

Each Zubercal parquet files contains ZTF PSF photometry in the following format:

Quantity,  parameter name,  data type
========================================
PS1 ID,        objectid,    64 bit int
MJD_tdb,       mjd,         64 bit float
mag,           mag,         32 bit float
mag_err*10000, magerr,      16 bit uint
ZTF field ID,  fieldid,     16 bit unit
rc id,         rcidin,       8 bit uint
infobits,      info,        32 bit int
phot flag,     flag,         8 bit uint
ra,            objra,       32 bit float
dec,           objdec,      32 bit float

MJD_tdb=Barycentric Dynamical Time (TDB) in MJD format, 
via astropy.time:
https://docs.astropy.org/en/stable/time/index.html
Accurate times are included so that very short period 
variables can be found.

The "phot flag" is the Zubercal bitwise photometry error flag.
0 = no error
1 = offset spatial correction map value exceeds limit (0.2)
2 = colour correction spatial map value exceeds limit (0.05 g, 0.02 r & i)
4 = time-based ZP magnitude correction exceeds limit (0.03)
8 = Quadrant-based surface fit correction exceeds limit (0.1)
16 = No file with best fit extinction surface found.
32 = Uncertainty from fit gives < 0.0015 mags. So IPAC mag error was adopted.

"PS1 ID", the PS1 object match with 1.2".
The "ra" and "dec" are individual the ZTF detection coords.
"rc id", the ZTF readout channel number.
"ZTF field ID", the usual ZTF field grid ID.
"Infobits", the same as IPAC infobits. But here it includes bit 26 for all ZTF phot.
"mag", the Zubercal-based magnitude.
"mag_err" is multiplied by 10000 to store as a 16 bit uint (vs a 32 bit float).

The python script, Zuber_parquet_to_txt.py, gives an example of
how to convert parquet files into ascii format.