The SXS catalog¶
The first thing to know about SXS data is just what's available, which we gather together in "the catalog", which contains information about all datasets. This information includes metadata about the simulations — like mass ratios, spins, etc. — as well as information about files that are available and where to find them.
The sxs.Catalog
¶
The concept of "the catalog" is made concrete in the form of an object available in the sxs
python module, which encapsulates all the catalog information. It's easy to load, like this:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import corner
import qgrid
import sxs
catalog = sxs.load("catalog")
Skipping download from 'https://data.black-holes.org/catalog.json' because local file is newer
The catalog
object has five top-level features:
modified
— most recent time stamp of new data on Zenodo/CaltechDATAdescription
— documents every piece of data found incatalog.json
; probably not interestingrecords
— details of every version of every record on Zenodo or CaltechDATA, including file info, URLs, etc.simulations
— metadata describing each simulation: mass ratios, spins, etc.select
— function to find the data files you care about
These are all accessible through the catalog
object. For example, to see the latest modification time, do this:
catalog.modified
'2020-09-09T14:00:27.593502'
If you need to know the gory details, you could also print catalog.description
.
You could also look at the details about what we've uploaded to Zenodo or CaltechDATA, under catalog.records
. But be aware that this is an extremely large dictionary; it might kill your browser to look at the whole thing. If you're interested, you could just look at the first record by uncommenting and running the following line:
# catalog.records["https://doi.org/10.5281/zenodo.1210581"]
But none of that is very interesting. The only really interesting things are simulations
and select
.
Simulations¶
The catalog.simulations
object gives you access to all of the metadata from all of the simulations SXS has published. Specifically, this is a dict
mapping SXS IDs (e.g., "SXS:BBH:0123") to Metadata objects. You can access each of those features just like you did on an individual metadata object in the previous notebook:
catalog.simulations["SXS:BBH:0123"].reference_dimensionless_spin1
[0.266756234962, 0.0203147886466, -0.415103367667]
[One fun point about this is that tab-completion works. As you type "SXS:BBH", for example, hit tab to get a list of the possibilities. Then, once you've closed the brackets, type ".ref" and hit tab again to get the possible metadata fields.]
As explained in the previous notebook, using these Metadata objects directly can be painful because of various missing values and inhomogeneous data types. We provide another interface to the data that strikes a compromise between preserving information and making the information usable. So, as far as possible, we force our metadata fields to have consistent datatypes within each column.
Simulations dataframe¶
The widely used pandas
package is designed for precisely this application: analysing tabular data with heterogeneously typed columns. It provides very powerful features for all sorts of sorting, selection, and statistical analysis. So we use pandas
to help us. Plus, we get to make this really cool table:
dataframe = catalog.table
qgrid.show_grid(dataframe, precision=8, show_toolbar=True, grid_options={"forceFitColumns": False})
You can sort by a column by clicking on the column header. You can also filter by value by clicking the icon in the header. Click on the little crossed arrows at the top-right corner of the table below to expand it to fill your browser.
Doing that and more, programatically¶
While graphical interfaces are fun, there is more reproducibility and power in programming.
Slices¶
We can slice the dataframe in a dizzying number of ways. But there are two that are simplest and most reliable. First, and most easily, we can take standard slices, like the first four elements:
dataframe[:4]
object_types | initial_separation | initial_orbital_frequency | initial_adot | initial_ADM_energy | initial_ADM_linear_momentum | initial_ADM_linear_momentum_mag | initial_ADM_angular_momentum | initial_ADM_angular_momentum_mag | initial_mass1 | ... | remnant_dimensionless_spin | remnant_dimensionless_spin_mag | remnant_velocity | remnant_velocity_mag | eos | initial_data_type | disk_mass | ejecta_mass | url | metadata_path | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SXS:BBH:0001 | BHBH | 18.0 | 0.012203 | -0.000025 | 0.993736 | [7.5160071e-09, 2.4389069e-09, -5.798632e-10] | 7.923059e-09 | [4.27581822e-08, -2.342625073e-07, 1.184715566... | 1.184716 | 0.5 | ... | [-7.29520687012e-10, 7.40468371215e-10, 0.6864... | 0.686462 | [1.45734870604e-09, 7.51603528474e-10, 3.72053... | 4.065850e-09 | NaN | BBH_CFMS | NaN | NaN | https://doi.org/10.5281/zenodo.1212426 | SXS:BBH:0001v1/Lev5/metadata.json |
SXS:BBH:0002 | BHBH | 19.0 | 0.011292 | -0.000021 | 0.994031 | [1.6810827e-09, 1.4244131e-09, -1.14839759e-08] | 1.169345e-08 | [2.7620419806e-06, -2.4287931932e-06, 1.210130... | 1.210131 | 0.5 | ... | [3.75218798083e-10, 1.32614402018e-09, 0.68644... | 0.686448 | [3.59963486031e-09, 7.18141003028e-09, 1.18947... | 1.435326e-08 | NaN | BBH_CFMS | NaN | NaN | https://doi.org/10.5281/zenodo.1210580 | SXS:BBH:0002v1/Lev6/metadata.json |
SXS:BBH:0003 | BHBH | 19.0 | 0.011284 | -0.000019 | 0.994277 | [2.599703e-09, -4.1239227e-09, 6.03918869017e-05] | 6.039189e-05 | [0.1251774015530911, -0.0006755685628109, 1.21... | 1.216661 | 0.5 | ... | [0.0664601205164, 0.00957605779857, 0.69144717... | 0.694700 | [0.000404512999056, 2.21067123662e-05, 0.00229... | 2.328050e-03 | NaN | BBH_CFMS | NaN | NaN | https://doi.org/10.5281/zenodo.1212572 | SXS:BBH:0003v1/Lev5/metadata.json |
SXS:BBH:0004 | BHBH | 19.0 | 0.011313 | -0.000028 | 0.994314 | [-2.7524803e-09, 5.883293e-09, 5.3376578e-09] | 8.407132e-09 | [8.163645183e-07, 7.736321355e-07, 1.094457487... | 1.094457 | 0.5 | ... | [9.13765586478e-10, -3.77301001538e-10, 0.6082... | 0.608209 | [0.000272458957071, 0.000295925023502, 7.01870... | 4.022505e-04 | NaN | BBH_CFMS | NaN | NaN | https://doi.org/10.5281/zenodo.1212574 | SXS:BBH:0004v1/Lev6/metadata.json |
4 rows × 56 columns
Or we can select columns to extract:
dataframe[["object_types", "initial_adot"]]
object_types | initial_adot | |
---|---|---|
SXS:BBH:0001 | BHBH | -0.000025 |
SXS:BBH:0002 | BHBH | -0.000021 |
SXS:BBH:0003 | BHBH | -0.000019 |
SXS:BBH:0004 | BHBH | -0.000028 |
SXS:BBH:0005 | BHBH | -0.000016 |
... | ... | ... |
SXS:BHNS:0003 | BHNS | 0.000000 |
SXS:BHNS:0004 | BHNS | -0.000022 |
SXS:BHNS:0005 | BHNS | -0.000025 |
SXS:BHNS:0006 | BHNS | -0.000012 |
SXS:BHNS:0007 | BHNS | -0.000015 |
2028 rows × 2 columns
To combine them, we just do them in sequence:
dataframe[:4][["object_types", "initial_adot"]]
object_types | initial_adot | |
---|---|---|
SXS:BBH:0001 | BHBH | -0.000025 |
SXS:BBH:0002 | BHBH | -0.000021 |
SXS:BBH:0003 | BHBH | -0.000019 |
SXS:BBH:0004 | BHBH | -0.000028 |
Tests¶
The concept of tests is fairly simply. For example, we can test whether or not the object_types
field is equal to BHNS
:
dataframe["object_types"] == "BHNS"
SXS:BBH:0001 False SXS:BBH:0002 False SXS:BBH:0003 False SXS:BBH:0004 False SXS:BBH:0005 False ... SXS:BHNS:0003 True SXS:BHNS:0004 True SXS:BHNS:0005 True SXS:BHNS:0006 True SXS:BHNS:0007 True Name: object_types, Length: 2028, dtype: bool
We get a pandas Series object, where most of the results say False
, but the last few say True
— because they are the ones for which the object_types
field is BHNS
. Now, we can use this Series just like we would in numpy to extract the items where this test gives us True
:
dataframe[dataframe["object_types"] == "BHNS"]
object_types | initial_separation | initial_orbital_frequency | initial_adot | initial_ADM_energy | initial_ADM_linear_momentum | initial_ADM_linear_momentum_mag | initial_ADM_angular_momentum | initial_ADM_angular_momentum_mag | initial_mass1 | ... | remnant_dimensionless_spin | remnant_dimensionless_spin_mag | remnant_velocity | remnant_velocity_mag | eos | initial_data_type | disk_mass | ejecta_mass | url | metadata_path | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SXS:BHNS:0001 | BHNS | 106.68 | 0.002537 | 0.000001 | 9.754357 | [-2.03885932771e-05, 9.797238987913e-05, -5.05... | 0.000100 | [1.71682e-10, -4.67012e-09, 46.6686927] | 46.668693 | 8.40000 | ... | [-5.33167104889e-06, -1.0448639427e-06, 0.3729... | 0.372924 | [0.000354153, 0.000387793, 1.87607e-06] | 0.000525 | polytrope(kappa=92.12,gamma=2) | BHNS | 0.000000 | 0.0 | https://doi.org/10.5281/zenodo.1215690 | SXS:BHNS:0001v1/Lev3/metadata.json |
SXS:BHNS:0002 | BHNS | 56.00 | 0.004456 | -0.000015 | 4.169582 | [-1.9413609314e-06, -8.496132757e-07, 1.095574... | 0.000002 | [0.0, 0.0, 16.60638426824671] | 16.606384 | 2.80000 | ... | NaN | NaN | [0.000742476, -3.7436e-05, 9.89369e-08] | 0.000743 | polytrope(kappa=101.45,gamma=2) | BHNS | 0.049606 | NaN | https://doi.org/10.5281/zenodo.1215694 | SXS:BHNS:0002v1/Lev3/metadata.json |
SXS:BHNS:0003 | BHNS | 51.43 | 0.005595 | 0.000000 | 5.400000 | [0, 0, 0] | 0.000000 | [0.0, 0.0, 16.60638426824671] | 16.606384 | 4.05001 | ... | NaN | NaN | not measured | NaN | PiecewisePolytrope(Gammas=1.3569,3.00; Transit... | BHNS | NaN | NaN | https://doi.org/10.5281/zenodo.2318272 | SXS:BHNS:0003v1/Lev2/metadata.json |
SXS:BHNS:0004 | BHNS | 39.20 | 0.006233 | -0.000022 | 2.778112 | [-1.2457454507e-06, 5.44427247228e-06, -6.2716... | 0.000006 | [0.0, 0.0, 8.447059816549256] | 8.447060 | 1.40000 | ... | NaN | NaN | NaN | NaN | polytrope(kappa=101.4496,gamma=2) | BHNS | NaN | NaN | https://doi.org/10.5281/zenodo.2317398 | SXS:BHNS:0004v1/Lev2/metadata.json |
SXS:BHNS:0005 | BHNS | 39.20 | 0.006235 | -0.000025 | 2.780039 | [2.981054730059816e-06, -1.22406716840395e-06,... | 0.000003 | [0.0, 0.0, 8.111755992167552] | 8.111756 | 1.40000 | ... | NaN | NaN | NaN | NaN | polytrope(kappa=101.4496,gamma=2) | BHNS | NaN | NaN | https://doi.org/10.5281/zenodo.2317404 | SXS:BHNS:0005v1/Lev2/metadata.json |
SXS:BHNS:0006 | BHNS | 52.50 | 0.004524 | -0.000012 | 3.475229 | [-3.413420373258928e-06, -2.0768413414982537e-... | 0.000004 | [0.0, 0.0, 12.993342233650518] | 12.993342 | 2.10000 | ... | NaN | NaN | NaN | NaN | polytrope(kappa=101.4496,gamma=2) | BHNS | NaN | NaN | https://doi.org/10.5281/zenodo.2317432 | SXS:BHNS:0006v1/Lev2/metadata.json |
SXS:BHNS:0007 | BHNS | 56.00 | 0.004454 | -0.000015 | 4.171456 | [4.867002495810236e-07, -1.5158476150901928e-0... | 0.000015 | [0.0, 0.0, 16.29283505660932] | 16.292835 | 2.80000 | ... | NaN | NaN | NaN | NaN | polytrope(kappa=101.4496,gamma=2) | BHNS | NaN | NaN | https://doi.org/10.5281/zenodo.2317426 | SXS:BHNS:0007v1/Lev2/metadata.json |
7 rows × 56 columns
(Here, we're just looking at the data, so we don't bother with the fancy grid we used above.)
Next, we might want to combine tests. This is done by putting each test inside parentheses, and combinging results with &
:
dataframe[(dataframe["object_types"] == "BHNS") & (dataframe["initial_separation"] < 52)]
object_types | initial_separation | initial_orbital_frequency | initial_adot | initial_ADM_energy | initial_ADM_linear_momentum | initial_ADM_linear_momentum_mag | initial_ADM_angular_momentum | initial_ADM_angular_momentum_mag | initial_mass1 | ... | remnant_dimensionless_spin | remnant_dimensionless_spin_mag | remnant_velocity | remnant_velocity_mag | eos | initial_data_type | disk_mass | ejecta_mass | url | metadata_path | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SXS:BHNS:0003 | BHNS | 51.43 | 0.005595 | 0.000000 | 5.400000 | [0, 0, 0] | 0.000000 | [0.0, 0.0, 16.60638426824671] | 16.606384 | 4.05001 | ... | NaN | NaN | not measured | NaN | PiecewisePolytrope(Gammas=1.3569,3.00; Transit... | BHNS | NaN | NaN | https://doi.org/10.5281/zenodo.2318272 | SXS:BHNS:0003v1/Lev2/metadata.json |
SXS:BHNS:0004 | BHNS | 39.20 | 0.006233 | -0.000022 | 2.778112 | [-1.2457454507e-06, 5.44427247228e-06, -6.2716... | 0.000006 | [0.0, 0.0, 8.447059816549256] | 8.447060 | 1.40000 | ... | NaN | NaN | NaN | NaN | polytrope(kappa=101.4496,gamma=2) | BHNS | NaN | NaN | https://doi.org/10.5281/zenodo.2317398 | SXS:BHNS:0004v1/Lev2/metadata.json |
SXS:BHNS:0005 | BHNS | 39.20 | 0.006235 | -0.000025 | 2.780039 | [2.981054730059816e-06, -1.22406716840395e-06,... | 0.000003 | [0.0, 0.0, 8.111755992167552] | 8.111756 | 1.40000 | ... | NaN | NaN | NaN | NaN | polytrope(kappa=101.4496,gamma=2) | BHNS | NaN | NaN | https://doi.org/10.5281/zenodo.2317404 | SXS:BHNS:0005v1/Lev2/metadata.json |
3 rows × 56 columns
Here, the combined test is only True
if both tests to return True
— the &
operator is the boolean AND. We also have OR with |
and XOR with ^
, as well as negation with ~
— though this can usually be achieved by changing the test.
Before we do anything else, it's convenient to use what we've just learned to separate out the different types of systems:
BHBH = dataframe[dataframe["object_types"] == "BHBH"]
BHNS = dataframe[dataframe["object_types"] == "BHNS"]
NSNS = dataframe[dataframe["object_types"] == "NSNS"]
Sorting¶
As with the fancy graphical table above, we can perform a standard sort with respect to any key:
BHBH.sort_values("initial_separation")
object_types | initial_separation | initial_orbital_frequency | initial_adot | initial_ADM_energy | initial_ADM_linear_momentum | initial_ADM_linear_momentum_mag | initial_ADM_angular_momentum | initial_ADM_angular_momentum_mag | initial_mass1 | ... | remnant_dimensionless_spin | remnant_dimensionless_spin_mag | remnant_velocity | remnant_velocity_mag | eos | initial_data_type | disk_mass | ejecta_mass | url | metadata_path | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SXS:BBH:1145 | BHBH | 8.768433 | 0.033400 | 0.000528 | 0.988193 | [4.0159705e-09, -2.8874734e-09, 2.20182446e-08] | 2.256698e-08 | [-5.79788e-11, -4.11334e-11, 0.8979940168937853] | 0.897994 | 0.555556 | ... | [2.69641681936e-09, -2.71527224746e-09, 0.6798... | 0.679879 | [-6.53052967664e-05, 0.000188526860992, 6.3951... | 0.000200 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.1236796 | SXS:BBH:1145v1/Lev3/metadata.json |
SXS:BBH:0059 | BHBH | 9.500000 | 0.030132 | -0.000199 | 0.994318 | [2.6420633e-09, 1.1066897e-09, 1.3278198614e-06] | 1.327823e-06 | [0.1667243799731394, -0.0991158740592164, 0.42... | 0.469100 | 0.833333 | ... | [0.155418128415, -0.0512385089505, 0.337978967... | 0.375513 | [-0.000694495031124, 3.83677686171e-05, -0.000... | 0.000842 | NaN | BBH_CFMS | NaN | NaN | https://doi.org/10.5281/zenodo.1212816 | SXS:BBH:0059v1/Lev3/metadata.json |
SXS:BBH:0057 | BHBH | 9.500000 | 0.030132 | -0.000199 | 0.994590 | [-1.0452306e-09, -1.5100829e-09, -6.4756965853... | 6.475697e-05 | [0.2382728616035303, -0.1799939345577782, 0.39... | 0.494012 | 0.833333 | ... | [0.234958063964, -0.114156958766, 0.326696719927] | 0.418292 | [0.000324395944759, -9.03947863005e-05, 0.0006... | 0.000715 | NaN | BBH_CFMS | NaN | NaN | https://doi.org/10.5281/zenodo.1212805 | SXS:BBH:0057v1/Lev5/metadata.json |
SXS:BBH:0165 | BHBH | 10.000000 | 0.028021 | -0.000077 | 0.995392 | [1.7677959695511642e-05, 2.8467798773184647e-0... | 1.510825e-03 | [0.5403280099904325, 0.135474141643271, 0.1230... | 0.570482 | 0.857143 | ... | [0.514930843643, 0.18754275343, 0.124880417703] | 0.562069 | [0.000882756527947, -0.000168742479688, 0.0015... | 0.001758 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.1213722 | SXS:BBH:0165v1/Lev3/metadata.json |
SXS:BBH:0147 | BHBH | 10.400000 | 0.026679 | 0.000000 | 0.990809 | [-3.1784791e-09, -1.1348076e-09, 0.00017327336... | 1.732734e-04 | [4.73944253e-08, -2.46119507e-08, 0.9844019930... | 0.984402 | 0.500000 | ... | [3.62334043636e-09, 9.40420789007e-10, 0.68121... | 0.681217 | [-3.23392833012e-09, -1.42677507146e-09, 0.006... | 0.006282 | NaN | BBH_CFMS | NaN | NaN | https://doi.org/10.5281/zenodo.1213513 | SXS:BBH:0147v1/Lev3/metadata.json |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
SXS:BBH:1390 | BHBH | 33.323792 | 0.004997 | 0.000011 | 0.996548 | [-1.77496077e-08, -1.17123042e-07, -3.2012603e... | 1.185036e-07 | [0.0651182944556768, 0.1991534256167426, 1.449... | 1.464799 | 0.586606 | ... | [0.0479822947564, 0.0987863723461, 0.659300052... | 0.668384 | [0.000385493530999, -0.000415381138861, 0.0001... | 0.000576 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.2554041 | SXS:BBH:1390v1/Lev3/metadata.json |
SXS:BBH:1389 | BHBH | 33.330627 | 0.004982 | -0.000003 | 0.996652 | [-1.42041209e-07, 1.262920632e-07, -7.3904003e... | 1.902104e-07 | [-0.1071574672896016, 0.1441296729085391, 1.35... | 1.363514 | 0.620205 | ... | [-0.0548672940108, 0.0456173244454, 0.59858761... | 0.602825 | [-0.000141779626136, 0.000207900102656, -0.001... | 0.001990 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.2553937 | SXS:BBH:1389v1/Lev3/metadata.json |
SXS:BBH:1414 | BHBH | 33.331787 | 0.004946 | 0.000004 | 0.996756 | [3.08971879e-08, 9.15551523e-08, 1.772e-12] | 9.662806e-08 | [-1.719425e-10, 3.40382e-11, 1.2446657895737823] | 1.244666 | 0.646643 | ... | [8.6007793081e-08, -3.23422018264e-08, 0.51583... | 0.515830 | [0.000985403806172, -0.000323418017036, -4.433... | 0.001037 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.2553730 | SXS:BBH:1414v1/Lev3/metadata.json |
SXS:BBH:1391 | BHBH | 33.341980 | 0.004973 | 0.000009 | 0.996759 | [1.15139875e-08, 8.7152341e-09, -3.1735086e-09] | 1.478507e-08 | [-0.1024976902142637, 0.0868581233170019, 1.26... | 1.268408 | 0.646893 | ... | [-0.0532562793571, 0.0553949985541, 0.54556007... | 0.550945 | [0.000263136844724, -0.000776945238151, -7.182... | 0.000823 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.2554137 | SXS:BBH:1391v1/Lev3/metadata.json |
SXS:BBH:1416 | BHBH | 33.369507 | 0.004964 | -0.000016 | 0.996738 | [7.9490309e-09, -1.17239956e-08, 3.532e-13] | 1.416472e-08 | [5.23902e-11, -3.85772e-11, 1.2035817620150357] | 1.203582 | 0.640288 | ... | [-7.85537377959e-09, 1.04904719133e-08, 0.4952... | 0.495241 | [0.000265873238418, -0.000601109413042, 6.4308... | 0.000657 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.2553801 | SXS:BBH:1416v1/Lev3/metadata.json |
2019 rows × 56 columns
But unlike the fancy graphical table above, we can use a function that serves as the sort key. (This sort of key function is also available in the standard python library's sorted
function.) Here, we'll sort by the absolute value of the difference between initial_separation
and 20.0.
sorting_field = "initial_separation"
desired_value = 20.0
BHBH.sort_values(sorting_field, key=lambda s: abs(s-desired_value))
object_types | initial_separation | initial_orbital_frequency | initial_adot | initial_ADM_energy | initial_ADM_linear_momentum | initial_ADM_linear_momentum_mag | initial_ADM_angular_momentum | initial_ADM_angular_momentum_mag | initial_mass1 | ... | remnant_dimensionless_spin | remnant_dimensionless_spin_mag | remnant_velocity | remnant_velocity_mag | eos | initial_data_type | disk_mass | ejecta_mass | url | metadata_path | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SXS:BBH:1130 | BHBH | 20.000000 | 0.010526 | 0.000001 | 0.994279 | [-1.240433e-10, 1.000485e-10, -0.0002327491542... | 2.327492e-04 | [8.52611666819e-05, 0.1452893471026843, 1.2337... | 1.242241 | 0.500000 | ... | [0.00188406749598, 0.0695155398536, 0.69620682... | 0.699671 | [-0.00013471699751, 5.06810812572e-05, 0.00027... | 0.000314 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.1236770 | SXS:BBH:1130v1/Lev3/metadata.json |
SXS:BBH:0623 | BHBH | 20.000000 | 0.009837 | 0.000055 | 0.994419 | [-1.2597544e-09, 2.584556e-10, -3.42284249539e... | 3.422842e-05 | [0.4507311241093057, -0.0400147208043062, 1.23... | 1.311154 | 0.526316 | ... | [0.287315333817, -0.0490837088878, 0.739541265... | 0.794909 | [-0.00013463801546, 8.320132769e-05, -0.000719... | 0.000737 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.1233603 | SXS:BBH:0623v1/Lev4/metadata.json |
SXS:BBH:1131 | BHBH | 20.000000 | 0.010403 | 0.000003 | 0.994285 | [1.47849e-11, -1.80773e-11, 0.0005509351422452] | 5.509351e-04 | [0.1509150594264362, -0.0062555203815311, 1.23... | 1.242480 | 0.500000 | ... | [0.0721783943415, -0.00491941344842, 0.6934392... | 0.697203 | [0.000521889766876, 0.000228777489857, 0.00421... | 0.004250 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.1231549 | SXS:BBH:1131v1/Lev3/metadata.json |
SXS:BBH:0204 | BHBH | 20.000000 | 0.010446 | -0.000005 | 0.997651 | [-4.10550747e-08, 2.06116119e-08, 9.9919665e-09] | 4.701273e-08 | [5.532205836e-06, 4.47633244527e-05, 0.8415017... | 0.841502 | 0.875000 | ... | [1.28618696803e-08, -1.99453459309e-09, 0.6056... | 0.605614 | [0.000156959552653, 0.000210992609871, 1.74121... | 0.000263 | NaN | BBH_CFMS | NaN | NaN | https://doi.org/10.5281/zenodo.1215024 | SXS:BBH:0204v1/Lev3/metadata.json |
SXS:BBH:0208 | BHBH | 20.077829 | 0.010400 | -0.000045 | 0.996921 | [-7.6155055e-09, 1.65908444e-08, 5.400935e-10] | 1.826318e-08 | [0.0028216032504505, 0.0179193304875078, 0.074... | 0.076538 | 0.833331 | ... | [-6.14426767972e-09, -1.03492898069e-09, -0.12... | 0.128169 | [-0.000579127747429, -0.000310130755305, -4.03... | 0.000657 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.1214310 | SXS:BBH:0208v1/Lev3/metadata.json |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
SXS:BBH:1390 | BHBH | 33.323792 | 0.004997 | 0.000011 | 0.996548 | [-1.77496077e-08, -1.17123042e-07, -3.2012603e... | 1.185036e-07 | [0.0651182944556768, 0.1991534256167426, 1.449... | 1.464799 | 0.586606 | ... | [0.0479822947564, 0.0987863723461, 0.659300052... | 0.668384 | [0.000385493530999, -0.000415381138861, 0.0001... | 0.000576 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.2554041 | SXS:BBH:1390v1/Lev3/metadata.json |
SXS:BBH:1389 | BHBH | 33.330627 | 0.004982 | -0.000003 | 0.996652 | [-1.42041209e-07, 1.262920632e-07, -7.3904003e... | 1.902104e-07 | [-0.1071574672896016, 0.1441296729085391, 1.35... | 1.363514 | 0.620205 | ... | [-0.0548672940108, 0.0456173244454, 0.59858761... | 0.602825 | [-0.000141779626136, 0.000207900102656, -0.001... | 0.001990 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.2553937 | SXS:BBH:1389v1/Lev3/metadata.json |
SXS:BBH:1414 | BHBH | 33.331787 | 0.004946 | 0.000004 | 0.996756 | [3.08971879e-08, 9.15551523e-08, 1.772e-12] | 9.662806e-08 | [-1.719425e-10, 3.40382e-11, 1.2446657895737823] | 1.244666 | 0.646643 | ... | [8.6007793081e-08, -3.23422018264e-08, 0.51583... | 0.515830 | [0.000985403806172, -0.000323418017036, -4.433... | 0.001037 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.2553730 | SXS:BBH:1414v1/Lev3/metadata.json |
SXS:BBH:1391 | BHBH | 33.341980 | 0.004973 | 0.000009 | 0.996759 | [1.15139875e-08, 8.7152341e-09, -3.1735086e-09] | 1.478507e-08 | [-0.1024976902142637, 0.0868581233170019, 1.26... | 1.268408 | 0.646893 | ... | [-0.0532562793571, 0.0553949985541, 0.54556007... | 0.550945 | [0.000263136844724, -0.000776945238151, -7.182... | 0.000823 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.2554137 | SXS:BBH:1391v1/Lev3/metadata.json |
SXS:BBH:1416 | BHBH | 33.369507 | 0.004964 | -0.000016 | 0.996738 | [7.9490309e-09, -1.17239956e-08, 3.532e-13] | 1.416472e-08 | [5.23902e-11, -3.85772e-11, 1.2035817620150357] | 1.203582 | 0.640288 | ... | [-7.85537377959e-09, 1.04904719133e-08, 0.4952... | 0.495241 | [0.000265873238418, -0.000601109413042, 6.4308... | 0.000657 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.2553801 | SXS:BBH:1416v1/Lev3/metadata.json |
2019 rows × 56 columns
So, if we want the 8 systems with initial separations closest to 20, we can just take them:
sorting_field = "initial_separation"
desired_value = 20.0
N = 8
BHBH.sort_values(sorting_field, key=lambda s: abs(s-desired_value))[:N]
object_types | initial_separation | initial_orbital_frequency | initial_adot | initial_ADM_energy | initial_ADM_linear_momentum | initial_ADM_linear_momentum_mag | initial_ADM_angular_momentum | initial_ADM_angular_momentum_mag | initial_mass1 | ... | remnant_dimensionless_spin | remnant_dimensionless_spin_mag | remnant_velocity | remnant_velocity_mag | eos | initial_data_type | disk_mass | ejecta_mass | url | metadata_path | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SXS:BBH:1130 | BHBH | 20.000000 | 0.010526 | 0.000001 | 0.994279 | [-1.240433e-10, 1.000485e-10, -0.0002327491542... | 2.327492e-04 | [8.52611666819e-05, 0.1452893471026843, 1.2337... | 1.242241 | 0.500000 | ... | [0.00188406749598, 0.0695155398536, 0.69620682... | 0.699671 | [-0.00013471699751, 5.06810812572e-05, 0.00027... | 0.000314 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.1236770 | SXS:BBH:1130v1/Lev3/metadata.json |
SXS:BBH:0623 | BHBH | 20.000000 | 0.009837 | 0.000055 | 0.994419 | [-1.2597544e-09, 2.584556e-10, -3.42284249539e... | 3.422842e-05 | [0.4507311241093057, -0.0400147208043062, 1.23... | 1.311154 | 0.526316 | ... | [0.287315333817, -0.0490837088878, 0.739541265... | 0.794909 | [-0.00013463801546, 8.320132769e-05, -0.000719... | 0.000737 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.1233603 | SXS:BBH:0623v1/Lev4/metadata.json |
SXS:BBH:1131 | BHBH | 20.000000 | 0.010403 | 0.000003 | 0.994285 | [1.47849e-11, -1.80773e-11, 0.0005509351422452] | 5.509351e-04 | [0.1509150594264362, -0.0062555203815311, 1.23... | 1.242480 | 0.500000 | ... | [0.0721783943415, -0.00491941344842, 0.6934392... | 0.697203 | [0.000521889766876, 0.000228777489857, 0.00421... | 0.004250 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.1231549 | SXS:BBH:1131v1/Lev3/metadata.json |
SXS:BBH:0204 | BHBH | 20.000000 | 0.010446 | -0.000005 | 0.997651 | [-4.10550747e-08, 2.06116119e-08, 9.9919665e-09] | 4.701273e-08 | [5.532205836e-06, 4.47633244527e-05, 0.8415017... | 0.841502 | 0.875000 | ... | [1.28618696803e-08, -1.99453459309e-09, 0.6056... | 0.605614 | [0.000156959552653, 0.000210992609871, 1.74121... | 0.000263 | NaN | BBH_CFMS | NaN | NaN | https://doi.org/10.5281/zenodo.1215024 | SXS:BBH:0204v1/Lev3/metadata.json |
SXS:BBH:0208 | BHBH | 20.077829 | 0.010400 | -0.000045 | 0.996921 | [-7.6155055e-09, 1.65908444e-08, 5.400935e-10] | 1.826318e-08 | [0.0028216032504505, 0.0179193304875078, 0.074... | 0.076538 | 0.833331 | ... | [-6.14426767972e-09, -1.03492898069e-09, -0.12... | 0.128169 | [-0.000579127747429, -0.000310130755305, -4.03... | 0.000657 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.1214310 | SXS:BBH:0208v1/Lev3/metadata.json |
SXS:BBH:1164 | BHBH | 19.921936 | 0.010549 | -0.000010 | 0.994893 | [-9.6732577e-09, -6.5265391e-08, 6.0972e-12] | 6.597835e-08 | [-1.99161e-11, -1.5144034e-09, 1.094666673182394] | 1.094667 | 0.666667 | ... | [5.85195843625e-10, -2.04209502196e-08, 0.6233... | 0.623383 | [0.000279870967942, 0.000432777479011, 3.68397... | 0.000515 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.1232290 | SXS:BBH:1164v1/Lev3/metadata.json |
SXS:BBH:1165 | BHBH | 19.921936 | 0.010549 | 0.000001 | 0.994892 | [2.7997771e-09, -5.7483834e-09, -3.4113e-12] | 6.393956e-09 | [-2.42045e-11, 1.7913e-11, 1.0946135606855216] | 1.094614 | 0.666667 | ... | [-3.30168871328e-09, 1.41692641503e-08, 0.6233... | 0.623391 | [0.000310040006886, 0.000413493726124, 4.52652... | 0.000517 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.1232851 | SXS:BBH:1165v1/Lev3/metadata.json |
SXS:BBH:1166 | BHBH | 19.921936 | 0.010555 | -0.000005 | 0.994900 | [-2.40322025e-08, -8.17916571e-08, -4.34e-12] | 8.524918e-08 | [1.128607e-10, -5.25064e-11, 1.0953007768263152] | 1.095301 | 0.666667 | ... | [-1.33446293855e-09, -1.44952389393e-08, 0.623... | 0.623428 | [-2.21472341997e-05, 0.000499326915338, 8.0359... | 0.000500 | NaN | BBH_SKS | NaN | NaN | https://doi.org/10.5281/zenodo.1232913 | SXS:BBH:1166v1/Lev3/metadata.json |
8 rows × 56 columns
Plotting¶
Pandas also makes it easy to plot the various quantities. For example, we can make a scatter plot of mass ratio versus $\chi_{\mathrm{eff}}$:
BHBH.plot("reference_mass_ratio", "reference_chi_eff", kind="scatter")
# pandas adds the column labels as axis labels, but we can make them look nicer
plt.xlabel(r"Mass ratio")
plt.ylabel(r"$\chi_{eff}$");
BHBH["com_correction_boost_velocity_mag"].plot.hist(log=True);
We can even make corner plots:
corner.corner(
BHBH[["reference_chi_eff", "reference_chi1_perp", "reference_mass_ratio", "reference_eccentricity"]].dropna(),
labels=[r"$\chi_{\mathrm{eff}}$", r"$\chi_{\perp}$", r"$q$", r"$e$"],
quiet=True
);
Selecting data sets¶
Once you have some idea of which simulations you're interested in, you have to actually get some of the data from them. The catalog
object has another useful feature to help you with this task: catalog.select
. This is a function that takes a string that — at least partially — specifies the simulation and dataset you want to load, and narrows down the list to exactly the file or files you request. It is used by sxs.load
to find files to load, and therefore understanding how select
works is important to understanding how sxs.load
works.
For example, suppose that catalog.simulations
has shown you that you want to look at SXS:BBH:0314. This isn't actually specific enough to get any data.
First, it turns out that there are four different versions of this simulation on Zenodo:
- SXS:BBH:0314v1
- SXS:BBH:0314v2
Each of these has at least one file that changed from the previous version. We only update files when we think we can improve them, so unless you're trying to reproduce results from some old version, you probably want the latest version. The select
function will help with this.
Second, we run most simulations at more than one resolution, to check for convergence. These resolutions are named "Lev" followed by some number. The number is complicated, but generally speaking: the higher this number is, the better. In each of the versions above, you will find
- Lev1
- Lev2
- Lev3
- Lev4
Again, unless you are checking convergence or comparing results with someone who used a lower Lev, you probably just want the highest Lev. And again, select
will help with this.
Third, you may not know which file you want, but you don't want to sift through catalog.records
to find your options. Here again, select
will do what you need.
Basically, select
walks through a path, trying to match the first component (the part up to the first "/"), narrowing the list down with that match, and moving on to the second component, etc. For each component, there are three options:
- An exact match. For example, you can enter "SXS:BBH:0314v1" to get that version.
- A partial match, like "SXS:BBH:0314". Here,
select
will take every component that matches what you've entered, and take the "largest" one. In this case, "v2" is the largest, so that's the one you get by default. Similarly, "Lev4" would be the largest in the list above. - A regex. If nothing has matched so far,
select
treats your string as a regex and looks for more matches. This lets you match multiple cases. For example,Lev.
would match every Lev, andLev(2|4)
would match only Levs 2 and 4 — though again,Lev
would return only the highest result: Lev4.
A few examples may help to clarify:
catalog.select("SXS:BBH:0314/Lev/rhOverM")
['SXS:BBH:0314v2/Lev4/rhOverM_Asymptotic_GeometricUnits_CoM.h5']
catalog.select("SXS:BBH:0314/Lev(2|4)/rhOverM")
['SXS:BBH:0314v2/Lev2/rhOverM_Asymptotic_GeometricUnits_CoM.h5', 'SXS:BBH:0314v2/Lev4/rhOverM_Asymptotic_GeometricUnits_CoM.h5']
catalog.select("SXS:BBH:0314v./Lev(2|4)/rhOverM")
['SXS:BBH:0314v1/Lev2/rhOverM_Asymptotic_GeometricUnits_CoM.h5', 'SXS:BBH:0314v1/Lev4/rhOverM_Asymptotic_GeometricUnits_CoM.h5', 'SXS:BBH:0314v2/Lev2/rhOverM_Asymptotic_GeometricUnits_CoM.h5', 'SXS:BBH:0314v2/Lev4/rhOverM_Asymptotic_GeometricUnits_CoM.h5']
These same strings could be passed to sxs.load
, and each of the matches would be loaded and returned.
Continue with the introduction to horizons.