{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Research example\n", "This notebook preserves a 2019 exploratory method by Andrew Dyck.\n", "Read README.md before running it. Full scientific validation is still needed.\n", "Outputs below have been cleared and do not represent a new execution.\n" ] }, { "cell_type": "code", "metadata": {}, "source": [ "from pathlib import Path\n", "Path(\"generated\").mkdir(exist_ok=True)\n" ], "outputs": [], "execution_count": null }, { "cell_type": "markdown", "metadata": {}, "source": [ "# FRB Pipeline Simulation" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%matplotlib notebook\n", "import numpy as np\n", "from matplotlib.pyplot import *\n", "import gc\n", "from scipy import signal" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", "def axis_labels(x, y, z):\n", " '''\n", " Creates the labels for the x, y axes and title as well as triggers the legend\n", " \n", " Note: Inputs must be strings\n", " \n", " \n", " INPUTS:\n", " \n", " x: (string) The label for the x-axis\n", " y: (string) The y-axis label\n", " z: (string) The title for the plot\n", " \n", " \n", " OUTPUTS:\n", " \n", " xlab : The x-axis label\n", " ylab : The y-axis label\n", " titles : The title\n", " legends: The legend of the plot\n", " \n", " '''\n", " \n", " xlab = xlabel(x)\n", " ylab = ylabel(y)\n", " titles = title(z)\n", " legends = legend\n", " return xlab, ylab, titles, legends\n", "\n", "\n", "def peakfinder_pulsar_DM(x, threshold):\n", " '''\n", " Finds the peaks in a dedispersed pulsar that has been run through a matched filter with a Gaussian.\n", " \n", " Note: The array or list used for x must have two dimensions. The first specifying which DM we are looking at, and \n", " the second representing the number of data points.\n", " \n", " The threshold must be appropriate for every DM. This means that it should have the same length as the \n", " number of DMs\n", " \n", " \n", " INPUTS:\n", " \n", " x : (array or list) The power of the pulse for every DM that has been looked at.\n", " threshold : (float) The y value at which peaks can be designated as peaks.\n", " \n", " \n", " OUTPUTS:\n", " \n", " peaksy: (list) The values ,for every DM, that can be called peaks over the threshold. \n", " \n", " \n", " '''\n", " \n", " peaksx = [] #This is the values that the peaks are centred around\n", " peaksy = []\n", " for j in range(np.shape(x)[0]):\n", " peakssy= []\n", " DM_intensity = x[j]\n", " for i in range(len(DM_intensity)-2):\n", " if DM_intensity[i] > threshold[j] and DM_intensity[i-2]10)[0]) >5:\n", " Pulsar = True\n", "else:\n", " Pulsar = False\n", "\n", "print(Pulsar)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "800000/400/5/4" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "750*.2" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.5" } }, "nbformat": 4, "nbformat_minor": 2 }