Metadata¶
For each simulation, you need to know its features: mass ratio, spins, etc. The sxs.metadata
object encapsulates that information, with nice interactive features to help you explore.
For any given simulation, you can load the metadata like this:
import sxs
metadata = sxs.load("SXS:BBH:0123/Lev/metadata.json")
Skipping download from 'https://data.black-holes.org/catalog.json' because local file is newer Found the following files to load from the SXS catalog: SXS:BBH:0123v4/Lev5/metadata.json
We'll be describing the sxs.load
function in more detail later. For now, let's focus on metadata
.
Essentially, metadata
is a standard python dict
, with a few extra bells and whistles. For example, it looks a bit tidier than your basic dict
:
metadata
Metadata([('simulation_name', 'd15-q1.1-sA_0.266_-0.0234_-0.416_sB_0.027_-0.0595_0.126/Lev5'), ('alternative_names', 'SXS:BBH:0123'), ('initial_data_type', 'BBH_CFMS'), ('object_types', 'BHBH'), ('number_of_orbits', 16.4621796348), ('reference_mass_ratio', 1.1004796188799273), ('reference_chi_eff', -0.15755434271832663), ('reference_chi1_perp', 0.26619415828746285), ('reference_chi2_perp', 0.06460212496073088), ('reference_eccentricity', '<7.2e-05'), ('reference_dimensionless_spin1', [0.266756234962, 0.0203147886466, -0.415103367667]), ('reference_dimensionless_spin2', [0.037600485, -0.053650766128, 0.12634712782]), ('reference_orbital_frequency', [-3.9872660232e-05, -0.00016988370621, 0.0159748747344]), ('reference_mass1', 0.524041316426), ('reference_mass2', 0.476193568182), ('reference_time', 180.0), ('reference_position1', [-6.86617129496, 2.00876691285, -0.0113043076212]), ('reference_position2', [7.48835793679, -2.18522132462, -0.0200766454997]), ('reference_mean_anomaly', 3.124065), ('keywords', ['Precessing-Spins', 'ManyMergers-Random32']), ('point_of_contact_email', 'mroue@cita.utoronto.ca'), ('authors_emails', ['Mike Boyle <boyle@astro.cornell.edu>', 'Dan Hemberger <daniel.hemberger@gmail.com>', 'Larry Kidder <kidder@astro.cornell.edu>', 'Geoffrey Lovelace <glovelace@fullerton.edu>', 'Abdul Mroue <mroue@cita.utoronto.ca>', 'Harald Pfeiffer <pfeiffer@cita.utoronto.ca>', 'Mark Scheel <scheel@tapir.caltech.edu>', 'Bela Szilagyi <bela@caltech.edu>', 'Nicholas Taylor <nwt2@cornell.edu>', 'Anil Zenginoglu <anil@caltech.edu>']), ('simulation_bibtex_keys', ['Mroue:2013xna', 'Boyle:2019kee', 'SXSCatalogWebsite']), ('code_bibtex_keys', ['Ossokine:2013zga', 'Hemberger:2012jz', 'Szilagyi:2009qz', 'Boyle:2009vi', 'Scheel:2008rj', 'Boyle:2007ft', 'Scheel:2006gg', 'Lindblom:2005qh', 'Pfeiffer:2002wt', 'SpECwebsite']), ('initial_data_bibtex_keys', ['Buchman:2012dw', 'Lovelace:2008tw', 'Pfeiffer:2007yz', 'Caudill:2006hw', 'Cook:2004kt']), ('quasicircular_bibtex_keys', ['Mroue:2012kv', 'Buonanno:2010yk', 'Mroue:2010re', 'Boyle:2007ft']), ('initial_separation', 15.0), ('initial_orbital_frequency', 0.0158541990364), ('initial_adot', -5.85085341309e-05), ('object1', 'bh'), ('object2', 'bh'), ('initial_ADM_energy', 0.9929656387750304), ('initial_ADM_linear_momentum', [9.51345e-10, 7.240775e-10, -2.40746180934e-05]), ('initial_ADM_angular_momentum', [0.0792457201929709, -0.0190274599776593, 1.0249969870433493]), ('initial_mass1', 0.523809523830852), ('initial_mass2', 0.476190476273648), ('initial_dimensionless_spin1', [0.265999999987, -0.023399999961, -0.41599999998]), ('initial_dimensionless_spin2', [0.0270000000093, -0.0595000000155, 0.126000000029]), ('initial_position1', [7.140836607632183, 0.0059699067005129, 0.0]), ('initial_position2', [-7.859163392367817, 0.0059699067005129, 0.0]), ('relaxation_time', 180.0), ('common_horizon_time', 4365.39365367), ('remnant_mass', 0.955826374012), ('remnant_dimensionless_spin', [0.0485870613722, -0.00260442740925, 0.631965084848]), ('remnant_velocity', [-0.00013415203028, 0.00025113351843, 0.00179443394367]), ('metadata_version', 1), ('spec_revisions', 'InitialCommit-20659-gdb7a1c7'), ('spells_revision', 'InitialCommit-21848-g8d8a7d7'), ('com_parameters', Metadata([('space_translation', [-0.01245591, 0.00560427, -0.00500452]), ('boost_velocity', [1.05374717e-05, -5.78475217e-06, -1.94870086e-05])])), ('initial_mass_ratio', 1.0999999998526622), ('metadata_path', '/Users/boyle/.sxs/cache/SXS:BBH:0123v4/Lev5/metadata.json')])
Some of these fields are more interesting than others. Presumably, the most interesting ones are the numbers — things like the mass ratio and spins. You can access them individually just like any dict
:
metadata["reference_mass_ratio"]
1.1004796188799273
Note that we have tab completion. For example, if you just start with
metadata["reference_m
and then hit tab, you'll see a list of possible completions. Every key can also be accessed as an attribute:
metadata.reference_mass_ratio
1.1004796188799273
This also gives you tab completion.
Finally, we also provide some backwards compatibility with the older NRAR metadata format, which called for hyphens to be used where we use underscores:
metadata["reference-mass-ratio"]
1.1004796188799273
Pain points with the metadata¶
One of the issues that has built up over time is the fact that metadata keys are not entirely consistent. For example, one key:value pair we see above is this:
metadata["reference_eccentricity"]
'<7.2e-05'
We might have expected to get a number out of this, but we got a string. This is because the eccentricity fitting function can't always find a very exact value, and only returns an upper bound. So if you're sorting through lots of different metadata files, looking for eccentricities — let's say — above 0.1, you might have a line that says
if metadata["reference_eccentricity"] > 0.1:
do_something()
Unfortunately, once you get to this particular metadata file, that test will raise an error:
metadata["reference_eccentricity"] > 0.1
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-7-4ba16a2155da> in <module> ----> 1 metadata["reference_eccentricity"] > 0.1 TypeError: '>' not supported between instances of 'str' and 'float'
There are also many datasets where values are missing. For example, many of these keys make no sense for simulations with matter (BHNS and NSNS); similarly many critical pieces of information in matter simulations are irrelevant for BBH simulations.
Pain reliever¶
The idea behind these metadata objects is that they should serve as the official records of what was written at the time the simulation was run. We don't want to be too clever above fixing the pain points, because we might incorrectly change some critical piece of information.
However, if you are willing to trade the possibility that this will replace data that you could make sense of with NaNs, for the sake of consistency, then the catalog
provides a more uniform interface to all the metadata collected in one place, in the form of catalog.table
.
Continue with the introduction to the catalog.