{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"#Code by Nayu. T.S.https://www.kaggle.com/nayuts/let-s-visualize-data-to-understand\n\nimport glob\n\nimport matplotlib.pyplot as plt\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport plotly.express as px\nimport seaborn as sns\n\n%matplotlib inline  ","metadata":{"execution":{"iopub.status.busy":"2021-06-30T19:31:03.432644Z","iopub.execute_input":"2021-06-30T19:31:03.432981Z","iopub.status.idle":"2021-06-30T19:31:03.439442Z","shell.execute_reply.started":"2021-06-30T19:31:03.432948Z","shell.execute_reply":"2021-06-30T19:31:03.43846Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<center style=\"font-family:verdana;\"><h1 style=\"font-size:200%; padding: 10px; background: #001f3f;\"><b style=\"color:#DC143C;\">Gravitational Waves</b></h1></center>","metadata":{}},{"cell_type":"markdown","source":"<font color=\"#EC7063\">What Is a Gravitational Wave?</font>\n\n\n\"A gravitational wave is an invisible (yet incredibly fast) ripple in space. Gravitational waves travel at the speed of light (186,000 miles per second). These waves squeeze and stretch anything in their path as they pass by.\"\n\n<font color=\"#EC7063\">What causes gravitational waves?</font>\n\n\"The most powerful gravitational waves are created when objects move at very high speeds. Some examples of events that could cause a gravitational wave are:\"\n\n\"When a star explodes asymmetrically (called a supernova).\"\n\n\"When two big stars orbit each other.\"\n\n\"When two black holes orbit each other and merge\"\n\n<font color=\"#EC7063\">How do we know that gravitational waves exist? LIGO</font>\n\n\"In 2015, scientists detected gravitational waves for the very first time. They used a very sensitive instrument called LIGO (Laser Interferometer Gravitational-Wave Observatory). These first gravitational waves happened when two black holes crashed into one another. The collision happened 1.3 billion years ago. But, the ripples didn’t make it to Earth until 2015!\"\n\nhttps://spaceplace.nasa.gov/gravitational-waves/en/","metadata":{}},{"cell_type":"markdown","source":"#<font color=\"#EC7063\">Types of Gravitational Waves. LIGO  A Gravitational-Wave Interferometer</font>\n\n\n\"LIGO scientists have defined four categories of gravitational waves based on what generates them: Continuous, Compact Binary Inspiral, Stochastic, and Burst. Each category of objects generates a unique or characteristic set of signal that LIGO's interferometers can sense, and that researchers can look for in LIGO’s data. \"\n\n<font color=\"#EC7063\">CONTINUOUS GRAVITATIONAL WAVES</font>\n\n\n\"Continuous gravitational waves are thought to be produced by a single spinning massive object like a neutron star. Any bumps on or imperfections in the spherical shape of this star will generate gravitational waves as it spins. If the spin-rate of the star stays constant, so too are the gravitational waves it emits. That is, the gravitational wave is continuously the same frequency and amplitude (like a singer holding a single note). That's why these are called “Continuous Gravitational Waves”.\"\n\n\n<font color=\"#EC7063\">COMPACT BINARY INSPIRAL GRAVITATIONAL WAVES</font>\n\n\n\"The next class of gravitational waves LIGO is hunting for is Compact Binary Inspiral gravitational waves. So far, all of the objects LIGO has detected fall into this category. Compact binary inspiral gravitational waves are produced by orbiting pairs of massive and dense (\"compact\") objects like white dwarf stars, black holes, and neutron stars. There are three subclasses of \"compact binary\" systems in this category of gravitational-wave generators:\"\n\n\"Binary Neutron Star (BNS);; Binary Black Hole (BBH);; Neutron Star-Black Hole Binary (NSBH).\"\n\n\"Each binary pair creates a unique pattern of gravitational waves, but the mechanism of wave-generation is the same across all three. It is called \"inspiral\".\n\n\"Inspiral occurs over millions of years as pairs of dense compact objects revolve around each other. As they orbit, they emit gravitational waves that carry away some of the system's orbital energy. As a result, over eons, the objects orbit closer and closer together. Unfortunately, moving closer causes them to orbit each other faster, which causes them to emit stronger gravitational waves, which causes them to lose more orbital energy, inch ever closer, orbit faster, lose more energy, move closer, orbit faster… etc. The objects are doomed, inescapably locked in a runaway accelerating spiraling embrace.\"\n\n\n<font color=\"#EC7063\">STOCHASTIC GRAVITATIONAL WAVES</font>\n\n\n\"Astronomers predict that there are so few significant sources of continuous or binary inspiral gravitational waves in the Universe that LIGO doesn't worry about the possibility of more than one passing by Earth at the same time (producing confusing signals in the detectors). However, we do presume that many small gravitational waves are passing by from all over the Universe all the time, and that they are mixed together at random. These small waves from every direction make up what is called a “Stochastic Signal”, so called because the word, 'stochastic' means having a random pattern that may be analyzed statistically but not predicted precisely. These will be the smallest and most difficult gravitational waves to detect, but it is possible that at least part of this stochastic signal may originate from the Big Bang. Detecting relic gravitational waves from the Big Bang will allow us to see farther back into the history of the Universe than ever before.\"\n\n<font color=\"#EC7063\">BURST GRAVITATIONAL WAVES</font>\n\n\n\"The search for 'burst gravitational waves' is truly a search for the unexpected—both because LIGO has yet to detect them, and because there are still so many unknowns that we really don’t know what to expect! For example, sometimes we don’t know enough about the physics of a system to predict how gravitational waves from that source will appear.\n\nWe also expect to detect gravitational waves from systems we never knew about before. To search for these kinds of gravitational waves, we cannot assume that they will have well-defined properties like those of continuous and compact binary inspiral waves. This means we cannot restrict our analyses to searching only for the signatures of gravitational waves that scientists have predicted.\n\nSearching for burst gravitational waves requires being utterly open-minded. For these kinds of gravitational waves, scientists must recognize a pattern of signals even when such a pattern has not been modeled (what we think a signal may look like) before. If you don’t know what you’re looking for, it’s really hard to find it. While this makes searching for burst gravitational waves difficult, detecting them has the greatest potential to reveal revolutionary information about the Universe.\"\n\nhttps://www.ligo.caltech.edu/page/gw-sources","metadata":{}},{"cell_type":"markdown","source":"<iframe width=\"727\" height=\"409\" src=\"https://www.youtube.com/embed/HTHjrt9y-Go\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>","metadata":{}},{"cell_type":"markdown","source":"#NASA’s Black Hole Field Guide: Episode 5 - Black Hole Records\n\nhttps://www.youtube.com/watch?v=HTHjrt9y-Go","metadata":{}},{"cell_type":"markdown","source":"How do we know the signal was from a compact binary ?\n\nHow do we know the (approximate) source parameters?\n\nHow do we know binary objects were black holes ? (or something that behaves very like them)\n\nhttps://indico.cern.ch/event/779256/contributions/3242644/attachments/1780516/2896456/dent_ggww_2.pdf","metadata":{}},{"cell_type":"markdown","source":"![](https://www.ligo.org/science/GW-Overview/images/inspiral_tn.jpg)https://www.ligo.org/science/GW-Inspiral.php","metadata":{}},{"cell_type":"markdown","source":"#<font color=\"#EC7063\">Gravitational-wave detection and Black Holes</font>\n\n\"The first direct gravitational-wave detection was made by the Advanced Laser Interferometer Gravitational Wave Observatory on September 14, 2015.\"\n\n\"The GW150914 signal was strong enough to be apparent, without using any waveform model, in the filtered detector strain data. Here those features of the signal visible in these data are used, along with only such concepts from Newtonian and General Relativity as are accessible to anyone with a general physics background.\" \n\n\"The signal was produced by the inspiral and subsequent merger of two black holes. The black holes were each of approximately 35 Msun, still orbited each other as close as 350 km apart and subsequently merged to form a single black hole. Similar reasoning, directly from the data, is used to roughly estimate how far these black holes were from the Earth, and the energy that they radiated\nin gravitational waves.\"\n\nLSC and Virgo Collaborations, Annalen der Physik, 2016\n\nhttps://indico.cern.ch/event/779256/contributions/3242644/attachments/1780516/2896456/dent_ggww_2.pdf","metadata":{}},{"cell_type":"code","source":"!ls ../input/g2net-gravitational-wave-detection","metadata":{"execution":{"iopub.status.busy":"2021-06-30T20:00:41.836483Z","iopub.execute_input":"2021-06-30T20:00:41.836842Z","iopub.status.idle":"2021-06-30T20:00:42.578145Z","shell.execute_reply.started":"2021-06-30T20:00:41.836811Z","shell.execute_reply":"2021-06-30T20:00:42.577096Z"},"_kg_hide-output":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#<font color=\"#EC7063\">Argument for a compact binary</font>\n\n\"GW signal shows several oscillations of massive body/bodies increasing in frequency & amplitude\"\n\n\"Not a perturbed system returning to equilibrium (damped sinusoid).\"\n\n\"Only physically plausible configuration is rotating (orbiting) binary.\"\n\n\"Binary masses and orbital radius imply compact objects, i.e. radius comparable to Schwarzschild\"\n\nhttps://indico.cern.ch/event/779256/contributions/3242644/attachments/1780516/2896456/dent_ggww_2.pdf\n","metadata":{}},{"cell_type":"code","source":"sub = pd.read_csv(\"../input/g2net-gravitational-wave-detection/sample_submission.csv\")\ntraining_labels = pd.read_csv(\"../input/g2net-gravitational-wave-detection/training_labels.csv\")","metadata":{"execution":{"iopub.status.busy":"2021-06-30T20:01:18.89854Z","iopub.execute_input":"2021-06-30T20:01:18.899111Z","iopub.status.idle":"2021-06-30T20:01:19.412648Z","shell.execute_reply.started":"2021-06-30T20:01:18.899064Z","shell.execute_reply":"2021-06-30T20:01:19.411678Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"training_labels.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-30T20:01:27.159846Z","iopub.execute_input":"2021-06-30T20:01:27.160228Z","iopub.status.idle":"2021-06-30T20:01:27.169265Z","shell.execute_reply.started":"2021-06-30T20:01:27.160194Z","shell.execute_reply":"2021-06-30T20:01:27.168533Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#<font color=\"#EC7063\">Why the system is not an IMRI (Intermediate-mass-ratio Inspirals)</font>\n\n\"Newtonian dynamics is pretty inaccurate close to black holes.\"\n\n\"Suppose the system was a heavy BH (mass M) with a much lighter companion, can we bound max GW (gravitational waves) frequency?\"\n\n\"Can’t orbit faster than light!\" \n\"Light ring radius is ≥ GM/c2, GW frequency emitted is at most c3 /(2𝜋GM) = 32(M☉/M) kHz\"\n\n\"So M can be at most ~200 M☉\"\n\nhttps://indico.cern.ch/event/779256/contributions/3242644/attachments/1780516/2896456/dent_ggww_2.pdf","metadata":{}},{"cell_type":"code","source":"#Code by Nayu. T.S.https://www.kaggle.com/nayuts/let-s-visualize-data-to-understand\n\ntrain_id = \"111012cee3\"\nsignal_array = np.load(f\"../input/g2net-gravitational-wave-detection/train/{train_id[1]}/{train_id[1]}/{train_id[1]}/{train_id}.npy\")","metadata":{"execution":{"iopub.status.busy":"2021-06-30T20:01:41.231176Z","iopub.execute_input":"2021-06-30T20:01:41.231672Z","iopub.status.idle":"2021-06-30T20:01:41.250333Z","shell.execute_reply.started":"2021-06-30T20:01:41.231641Z","shell.execute_reply":"2021-06-30T20:01:41.249657Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#<font color=\"#EC7063\">The eccentricity enhancement effect of (IMRI) intermediate-mass-ratio-inspirals: dark matter and black hole mass</font>\n\nAuthors: Meirong Tang, Jiancheng Wang - DOI:10.1088/1674-1137/abc680\narXiv:2005.11933 [gr-qc]\n\n\"It was found that the dark matter (DM) in the intermediate-mass-ratio-inspiral (IMRI) system has a significant enhancement effect on the orbital eccentricity of the stellar massive compact object, such as a black hole (BH), which may be tested by space-based gravitational wave (GW) detectors including LISA, Taiji and Tianqin in future observations.\"\n\n\"In that paper, the authors studied the enhancement effect of the eccentricity for an IMRI under different DM (dark matter) density profiles and center BH masses. Their results are as follows: (1) in terms of the general DM spike distribution, the enhancement of the eccentricity is basically consistent with the power-law profile, which indicates that it is reasonable to adopt the power-law profile; (2) in the presence of DM (dark matter) spike, the different masses of the center BH will affect the eccentricity, which provides a new way for us to detect the BH's mass; (3) considering the change of the eccentricity in the presence and absence of DM spike, they founnd that it is possible to distinguish DM models by measuring the eccentricity at the scale of about 105GM/c2.\"\n\nhttps://arxiv.org/abs/2005.11933","metadata":{}},{"cell_type":"code","source":"#Code by Dom de Jonge https://www.kaggle.com/domdejonge/sample-code\n\nplot = np.load(\"../input/g2net-gravitational-wave-detection/train/1/1/1/111012cee3.npy\")\nplt.plot(plot[0])\nplt.title('111012cee3.npy');","metadata":{"execution":{"iopub.status.busy":"2021-06-30T22:18:13.829476Z","iopub.execute_input":"2021-06-30T22:18:13.829804Z","iopub.status.idle":"2021-06-30T22:18:13.959667Z","shell.execute_reply.started":"2021-06-30T22:18:13.829775Z","shell.execute_reply":"2021-06-30T22:18:13.959018Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#<font color=\"#EC7063\">Are Black Holes Black?</font>\n\n\"There’s this kind of irony of black holes that are black and invisible. But they’re also some of the brightest objects in the entire known universe. And the reason is, because when you tend to get too close to a black hole, if you’re a planet or a star cloud of gas, you get whipped around into a really fast orbit going nearly the speed of light, heated up to millions of degrees and shining out in bright ultraviolet, X-ray, radio, just really bright, bright sources of light coming from not the black hole itself, but from the effect that it has on anyone who gets too close to it. So that’s why, that’s how we see them. That’s how we study them. For the most part.\"\n\n\"One in 1,000 stars becomes a black hole at the end of its life. And if you think about the fact that we have over 100 billion stars in the Milky Way, you do the math and you end up with over 100 million black holes floating around the Milky Way. And we’ve seen 40 of them. So that leaves 99,999,000 and change that we’ve never even detected, and they’re just going to be sprinkled throughout the, the Milky Way, just like all the stars. And again, do a little bit of math, and the chances are, that there’s a black hole that we’ve never even seen within only, say, 25 light-years of the Earth. I mean, it doesn’t pose any immediate risk. But, when whenever it happened, billion years ago, when it went supernova, it would have been a pretty bright day out.\"\n\nhttps://scitechdaily.com/nasas-gravity-assist-black-hole-mysteries/","metadata":{}},{"cell_type":"code","source":"#Code by Dom de Jonge https://www.kaggle.com/domdejonge/sample-code\n\nplot = np.load(\"../input/g2net-gravitational-wave-detection/train/4/4/4/444033bea9.npy\")\nplt.plot(plot[0], color='red')\nplt.title('444033bea9.npy');","metadata":{"execution":{"iopub.status.busy":"2021-06-30T22:17:34.310334Z","iopub.execute_input":"2021-06-30T22:17:34.310722Z","iopub.status.idle":"2021-06-30T22:17:34.449386Z","shell.execute_reply.started":"2021-06-30T22:17:34.310692Z","shell.execute_reply":"2021-06-30T22:17:34.448618Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#<font color=\"#EC7063\">Rare and Record-Breaking Black Holes</font>\n\n\"While even the most “normal” black hole seems exotic compared to the tranquil objects in our solar system, there are some record-breaking oddballs. Tag along as we look at the biggest, closest, farthest, and even “spinniest” black holes discovered in the universe … that we know of right now!\"\n\n\"Located 700 million light-years away in the galaxy Holmberg 15A, astronomers found a black hole that is a whopping 40 billion times the mass of the Sun — setting the record for the biggest black hole found so far. On the other hand, the smallest known black hole isn’t quite so easy to pinpoint. There are several black holes with masses around five times that of our Sun. There’s even one candidate with just two and a half times the Sun’s mass, but scientists aren’t sure whether it’s the smallest known black hole or actually the heaviest known neutron star!\"\n\n\"You may need to take a seat for this one. The black hole GRS 1915+105 will make you dizzier than an afternoon at an amusement park, as it spins over 1,000 times per second! Maybe even more bizarre than how fast this black hole is spinning is what it means for a black hole to spin at all! What we’re actually measuring is how strongly the black hole drags the space-time right outside its event horizon — the point where nothing can escape. Yikes!\"\n\n\"If you’re from Earth, the closest black hole that we know of right now, Mon X-1 in the constellation Monoceros, is about 3,000 light-years away. But never fear — that’s still really far away! The farthest known black hole is J0313-1806. The light from its surroundings took a whopping 13 billion years to get to us! And with the universe constantly expanding, that distance continues to grow.\"\n\n\"Three scientists received the 2017 Nobel Prize in Physics for using LIGO to observe gravitational waves that were sent out from colliding stellar-mass black holes. Though gravitational waves are hard to detect, they offer a way to find black holes without having to see any light.\"\n\nhttps://nasa.tumblr.com/post/648639029765668864/rare-record-breaking-black-holes","metadata":{}},{"cell_type":"code","source":"#Code by Dom de Jonge https://www.kaggle.com/domdejonge/sample-code\n\nplot = np.load(\"../input/g2net-gravitational-wave-detection/train/2/2/2/22203a58d0.npy\")\nplt.plot(plot[0], color='green')\nplt.title('22203a58d0.npy');","metadata":{"execution":{"iopub.status.busy":"2021-06-30T22:16:56.856475Z","iopub.execute_input":"2021-06-30T22:16:56.856809Z","iopub.status.idle":"2021-06-30T22:16:56.989464Z","shell.execute_reply.started":"2021-06-30T22:16:56.85678Z","shell.execute_reply":"2021-06-30T22:16:56.988456Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#<font color=\"#EC7063\">How are gravitational waves detected?</font>\n\n\"When a gravitational wave passes by Earth, it squeezes and stretches space. LIGO can detect this squeezing and stretching. Each LIGO observatory has two “arms” that are each more than 2 miles (4 kilometers) long. A passing gravitational wave causes the length of the arms to change slightly. The observatory uses lasers, mirrors, and extremely sensitive instruments to detect these tiny changes.\"\n\nhttps://spaceplace.nasa.gov/gravitational-waves/en/","metadata":{}},{"cell_type":"code","source":"#Code by Dom de Jonge https://www.kaggle.com/domdejonge/sample-code\n\nplot = np.load(\"../input/g2net-gravitational-wave-detection/train/5/5/5/5550107902.npy\")\nplt.plot(plot[0], color='purple')\nplt.title('5550107902.npy');","metadata":{"execution":{"iopub.status.busy":"2021-06-30T22:16:08.207432Z","iopub.execute_input":"2021-06-30T22:16:08.207983Z","iopub.status.idle":"2021-06-30T22:16:08.350068Z","shell.execute_reply.started":"2021-06-30T22:16:08.20795Z","shell.execute_reply":"2021-06-30T22:16:08.349223Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#<font color=\"#EC7063\">Rogue Black Holes</font>\n\n\"Hundreds of rogue black holes should be traveling the Milky Way's outskirts, each containing the mass of 1,000 to 100,000 suns. They would be difficult to spot on their own because a black hole is visible only when it is swallowing, or accreting, matter.\"\n\n\"The number of rogue black holes in our galaxy depends on how many of the proto-galactic building blocks contained black holes at their cores, and how those proto-galaxies merged to form the Milky Way. Finding and studying them will provide new clues about the history of our galaxy.\"\n\n\"For now, Earth is safe. The closest rogue black hole should reside thousands of light-years away.\"\n\nhttps://phys.org/news/2009-04-rogue-black-holes-roam-milky.html","metadata":{}},{"cell_type":"markdown","source":"![](https://media1.giphy.com/media/1uoCqJLj04oZq/200w.webp?cid=ecf05e478h5mwf1rj7xlleeklb5ofmp75i1exykyais1mh2x&rid=200w.webp&ct=g)","metadata":{}}]}