o qf@sDddlmZddlZddlZGdddejZGdddejZdS)Nc$eZdZfddZddZZS)UnormGPScs2t|dttjdtjgddS)N gps_normalizeg?r)super__init__register_buffertorchTensornppi unsqueezeself __class__:/home/dufour/Documents/diff_plonk/models/postprocessing.pyrs (zUnormGPS.__init__cCst|dd}||jS)z0Unormalize latitude longtitude radians to -1, 1.)rclampr)rxrrrforward s zUnormGPS.forward__name__ __module__ __qualname__rr __classcell__rrrrrs rcr)CartesiantoGPScstdS)N)rrr rrrrszCartesiantoGPS.__init__cCsT|dddf}|dddf}|dddf}|}||}tj||gddS)Nrrr)dim)arcsinatan2rstack)r cartesianryzlatlonrrrrs  zCartesiantoGPS.forwardrrrrrrs r)torch.nnnnrnumpyr Modulerrrrrrs