Skip to content

Commit

Permalink
add coordinates_space.py (gwastro#4289)
Browse files Browse the repository at this point in the history
* add coordinates_space.py

* add LISA/SSB frame params

* add LISA_to_GEO and GEO_to_LISA

* add coordinates_space into FieldArray

* add doc and Astropy support

* update comments on sympy

* use fsolve from scipy instead

* fix cc issues

* fix cc issues

* minor fix

* update

* not use iteration

* decouple LISA orbit and more accurate Earth

* rename

* remove jplephem

* add the angular displacement of the Earth

* use radians

* make func readable in .ini

* reverse back to master

* correct psi range

* reverse to master

* fix unit issue in earth_position_SSB

* put LISA to the "right" position

* add LISA specific transform classes here

* change names

* update

* make a package for coordinates

* remove coordinates_space import

* move __all__ into __init__.py

* remove all coordinates_space

* change TIME_OFFSET to seconds

* fix SOBHB issue

* rename

* add SSB or LISA params into fid_params

* rename

* fix cc issues

* fix cc issue

* fix cc issue

* update

* update

* fix

* add default names

* overwrite params with same names

* remove pre-fixed names

* remove all pre-fixed names

* not pop

* fix inverse transform

* update tc

* not overwrite

* add SNR support for multi-model

* Update waveform.py

* t0 issue

* t0 issue

* Update space.py

* add obstime

* np.mod(psi_newframe, 2*np.pi)

* fix obstime

* add support for array inputs

* Update hierarchical.py

* just use Alex's implementation

* CustomTransformMultiOutputs is in another PR, so remove it

* add LDC and LAL convention correction

* use pycbc standard names

* more meaningful name

* use pycbc standard names

* Update relbin.py

* Update parameters.py

* remove unnecessary changes

* fix cc issue

* fix cc issue

* fix cc issue

* fix cc issue

* compactify

* compactify

* add __all__ back

* Update transforms.py

* Update transforms.py

* Update test_transforms.py

* Update transforms.py

* update doc

* fix time warning

* Update space.py

* Update test_transforms.py

* Create test_coordinates_space.py

* fix cc issues

* fix cc issues

* fix cc issue

* Update tox.ini

* Update tox.ini

* Update tox.ini

* Update tox.ini

* Update tox.ini

* Update tox.ini

* Update tox.ini

* Update test_coordinates_space.py

* add inline doc

* Update tox.ini

* add check of bbhx

* Update test_coordinates_space.py

* Update tox.ini

* Update test_coordinates_space.py

* add MultibandRelativeTimeDom into hierarchical.py

* Update __init__.py

* Update hierarchical.py

* Update hierarchical.py

* Update relbin.py

* Update hierarchical.py

* Update hierarchical.py

* Update relbin.py

* Update hierarchical.py

* Update hierarchical.py

* Update hierarchical.py

* Update hierarchical.py

* Update hierarchical.py

* Update relbin.py

* Update hierarchical.py

* Update hierarchical.py

* Update relbin.py

* Update __init__.py

* Update space.py

* Update space.py

* Update space.py

* fix psi issue

* Update test_coordinates_space.py

* Update test_coordinates_space.py
  • Loading branch information
WuShichao authored and acorreia61201 committed Apr 4, 2024
1 parent 4a5fa77 commit 99d36da
Show file tree
Hide file tree
Showing 7 changed files with 1,905 additions and 6 deletions.
37 changes: 37 additions & 0 deletions pycbc/coordinates/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (C) 2023 Shichao Wu, Alex Nitz
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""
This modules provides functions for base coordinate transformations, and
more advanced transformations between ground-based detectors and space-borne
detectors.
"""

from pycbc.coordinates.base import *
from pycbc.coordinates.space import *


__all__ = ['cartesian_to_spherical_rho', 'cartesian_to_spherical_azimuthal',
'cartesian_to_spherical_polar', 'cartesian_to_spherical',
'spherical_to_cartesian',
'TIME_OFFSET_20_DEGREES',
'localization_to_propagation_vector',
'propagation_vector_to_localization', 'polarization_newframe',
't_lisa_from_ssb', 't_ssb_from_t_lisa',
'ssb_to_lisa', 'lisa_to_ssb',
'rotation_matrix_ssb_to_lisa', 'rotation_matrix_ssb_to_geo',
'lisa_position_ssb', 'earth_position_ssb',
't_geo_from_ssb', 't_ssb_from_t_geo', 'ssb_to_geo', 'geo_to_ssb',
'lisa_to_geo', 'geo_to_lisa',
]
17 changes: 15 additions & 2 deletions pycbc/coordinates.py → pycbc/coordinates/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,18 @@
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
""" Coordinate transformations.


#
# =============================================================================
#
# Preamble
#
# =============================================================================
#
"""
Base coordinate transformations, this module provides transformations between
cartesian and spherical coordinates.
"""
import numpy

Expand Down Expand Up @@ -60,6 +71,7 @@ def cartesian_to_spherical_azimuthal(x, y):
phi = numpy.arctan2(y, x)
return phi % (2 * numpy.pi)


def cartesian_to_spherical_polar(x, y, z):
""" Calculates the polar angle in spherical coordinates from Cartesian
coordinates. The polar angle is in [0,pi].
Expand Down Expand Up @@ -141,7 +153,8 @@ def spherical_to_cartesian(rho, phi, theta):
z = rho * numpy.cos(theta)
return x, y, z


__all__ = ['cartesian_to_spherical_rho', 'cartesian_to_spherical_azimuthal',
'cartesian_to_spherical_polar', 'cartesian_to_spherical',
'spherical_to_cartesian',
]
]
Loading

0 comments on commit 99d36da

Please sign in to comment.