Exemple #1
0
# You should have received a copy of the GNU General Public License
# along with GWpy.  If not, see <http://www.gnu.org/licenses/>.
"""Plotting an `EventTable` in a histogram

I would like to study the distribution of the GW events detected to date.
"""

__author__ = "Duncan Macleod <*****@*****.**>"
__currentmodule__ = 'gwpy.table'

# First, we can download the ``'GWTC-1-confident'`` catalogue using
# :meth:`EventTable.fetch_open_data`:

from gwpy.table import EventTable
events = EventTable.fetch_open_data(
    "GWTC-1-confident",
    columns=("mass_1_source", "mass_2_source"),
)
events.add_column(events["mass_1_source"] + events["mass_2_source"],
                  name="mtotal")

# and can generate a new `~gwpy.plot.Plot` using the
# :meth:`~EventTable.hist` method:

plot = events.hist('mtotal', bins=10, range=(0, 100), histtype='stepfilled')
ax = plot.gca()
ax.set_xlabel(r"Total mass [M$_{\odot}$]")
ax.set_ylabel("Number of events")
ax.set_title("GWTC-1-confident")
plot.show()
Exemple #2
0
from gwpy.table import EventTable
events = EventTable.fetch_open_data(
    "GWTC-1-confident",
    columns=("mass1", "mass2"),
)
events.add_column(events["mass1"] + events["mass2"], name="mtotal")
Exemple #3
0
"""Plotting an `EventTable` in a scatter

We can use GWpy's `EventTable` to download the catalogue of gravitational-wave
detections, and create a scatter plot to investigate the mass distribution
of events.
"""

__author__ = "Duncan Macleod <*****@*****.**>"
__currentmodule__ = 'gwpy.table'

# First, we can download the ``'GWTC-1-confident'`` catalogue using
# :meth:`EventTable.fetch_open_data`:

from gwpy.table import EventTable
events = EventTable.fetch_open_data(
    "GWTC-1-confident",
    columns=("mass1", "mass2", "E_rad", "distance"),
)

# We can now make a scatter plot by specifying the x- and y-axis columns,
# and (optionally) the colour:

plot = events.scatter("mass1", "mass2", color="E_rad")
plot.colorbar(label="E_rad [{}]".format(r"M$_{\odot}$ c$^{2}$"))
plot.show()

# We can similarly plot how the total event mass is distributed with
# distance.  First we have to build the total mass (``'mtotal'``) column
# from the component masses:

events.add_column(events["mass1"] + events["mass2"], name="mtotal")
We can use GWpy's `EventTable` to download the catalogue of gravitational-wave
detections, and create a scatter plot to investigate the mass distribution
of events.
"""

__author__ = "Duncan Macleod <*****@*****.**>"
__currentmodule__ = 'gwpy.table'

# First, we can download the ``'GWTC-1-confident'`` catalogue using
# :meth:`EventTable.fetch_open_data`:

from gwpy.table import EventTable

events = EventTable.fetch_open_data(
    "GWTC-1-confident",
    columns=("mass_1_source", "mass_2_source", "chirp_mass_source",
             "luminosity_distance"),
)

# We can now make a scatter plot by specifying the x- and y-axis columns,
# and (optionally) the colour:

plot = events.scatter("mass_1_source",
                      "mass_2_source",
                      color="chirp_mass_source")
plot.colorbar(label="Chirp_mass [{}]".format(r"M$_{\odot}$"))
plot.show()

# We can similarly plot how the total event mass is distributed with
# distance.  First we have to build the total mass (``'mtotal'``) column
# from the component masses:
Exemple #5
0
"""Plotting an `EventTable` in a scatter

We can use GWpy's `EventTable` to download the catalogue of gravitational-wave
detections, and create a scatter plot to investigate the mass distribution
of events.
"""

__author__ = "Duncan Macleod <*****@*****.**>"
__currentmodule__ = 'gwpy.table'

# First, we can download the ``'GWTC-1-confident'`` catalogue using
# :meth:`EventTable.fetch_open_data`:

from gwpy.table import EventTable
events = EventTable.fetch_open_data(
    "GWTC-1-confident",
    columns=("mass1", "mass2", "E_rad", "distance"),
)

# We can now make a scatter plot by specifying the x- and y-axis columns,
# and (optionally) the colour:

plot = events.scatter("mass1", "mass2", color="E_rad")
plot.colorbar(label="E_rad [{}]".format(r"M$_{\odot}$ c$^{2}$"))
plot.show()

# We can similarly plot how the total event mass is distributed with
# distance.  First we have to build the total mass (``'mtotal'``) column
# from the component masses:

events.add_column(events["mass1"] + events["mass2"], name="mtotal")