Non-Imaging Transient Reconstruction And TEmporal Search (NITRATES)

Related tags

Deep LearningNITRATES
Overview

Non-Imaging Transient Reconstruction And TEmporal Search (NITRATES)

This repo contains the full NITRATES pipeline for maximum likelihood-driven discovery and localization of Gamma Ray Bursts in the Neil Gehrels Swift Observatory's Burst Alert Telescope (BAT) instrument.

A description of the method can be found in DeLaunay & Tohuvavohu (2021). We ask scientific users of this code to cite the paper.

The BAT instrumental response functions necessary for this pipeline can be found in this Zenodo community.

Current Analysis Scripts

run_stuff_grb2.sh Used to run the full targeted analysis. Runs mkdb.py, do_data_setup.py, do_full_rates.py, then do_manage2.py first arg is the trigger time, second arg is the Name of the trigger, and the optional third arg is the minimum duration to use

mkdb.py Creates an sqlite DB that contains the trigger time and important file names DB not used much in the analysis, used to be used to store results and is kind of a relic now

do_data_setup.py Gathers the event, attitude, and enabled detectors files Chooses which dets to mask, based on any hot or cold dets or any det glitches Makes a "filtered" event file that has the events removed outside the usable energy range or far away from the analysis time Also adds a GTI table to the event file for when it's not slewing and there's no multi-det glitches Also makes a partial coding image if there's a usable set of HEASOFT tools

do_full_rates.py Runs the full rates analysis to pick time bins as seeds for the analysis

do_manage2.py Manages the rest of the analysis Submits jobs to the cluster, organizes results, and emails out top results First submits a job for the bkg fit to off-time data Then submits several jobs for the split detector rates analysis Gathers the split rates results and makes the final set of position and time seeds Assigns which jobs will processes which seeds and writes them to rate_seeds.csv (for inside FoV jobs) and out_job_table.csv (for out of FoV jobs) Submits several jobs to the cluster for both inside FoV and outside FoV analysis Gathers results and emails out top results when all of the jobs are done

do_bkg_estimation_wPSs_mp2.py Script to perform the bkg fit to off-time data Ran as a single job, usually with 4 procs

do_rates_mle_InOutFoV2.py Script to perform the split rates analysis Ran as several single proc jobs

do_llh_inFoV4realtime2.py Script to perform the likelihood analysis for seeds that are inside the FoV Ran as several single proc jobs

do_llh_outFoV4realtime2.py Script to perform the likelihood analysis for seeds that are outside the FoV Ran as several single proc jobs

Important Modules

LLH.py

  • Has class and functions to compute the LLH
  • The LLH_webins class handles the data and LLH calculation for a given model and paramaters
    • It takes a model object, the event data, detmask, and start and stop time for inputs
    • Converts the event data within the start and stop time into a 2D histogram in det and energy bins
    • Can then compute the LLH for a given set of paramaters for the model
    • Can do a straight Poisson likelihood or Poisson convovled with a Gaussian error

minimizers.py

  • Funtctions and classes to handle numerically minimizing the NLLH
  • Most minimizer objects are subclasses of NLLH_Minimizer
    • Contains functions for doing parameter transformations and setting bounds
    • Also handles mapping the tuple of paramter values used for a standard scipy minimizer to the dict of paramater names and values used by the LLH and model objects

models.py

  • Has the models that convert input paramaters into the count rate expectations for each det and energy bin in the LLH
  • The models are sub classes of the Model class
  • Currently used diffuse model is Bkg_Model_wFlatA
  • Currently used point source model is Source_Model_InOutFoV, which supports both in and out of FoV positions
  • Currently used simple point source model for known sources is Point_Source_Model_Binned_Rates
  • CompoundModel takes a list of models to make a single model object that can give the total count expectations from all models used

flux_models.py

  • Has functions and classes to handle computing fluxes for different flux models
  • The different flux model object as subclasses of Flux_Model
    • Flux_Model contains methods to calculate the photon fluxes in a set of photon energy bins
    • Used by the response and point source model objects
  • The different available flux models are:
    • Plaw_Flux for a simple power-law
    • Cutoff_Plaw_Flux for a power-law with an exponential cut-off energy
    • Band_Flux for a Band spectrum

response.py

  • Contains the functions and objects for the point source model
  • Most current response object is ResponseInFoV2 and is used in the Source_Model_InOutFoV model

ray_trace_funcs.py

  • Contains the functions and objects to read and perform bilinear interpolation of the foward ray trace images that give the shadowed fraction of detectors at different in FoV sky positions
  • RayTraces class manages the reading and interpolation and is used by the point source response function and simple point source model
Comments
  • Example_LLH_setup_fixed_dirs.ipynb Incorrect import

    Example_LLH_setup_fixed_dirs.ipynb Incorrect import

    In the Example_LLH_setup_fixed_dirs.ipynb there is a block that states:

    from do_manage import im_dist
    

    this gives an error since there is no file in the package with this name. Instead there is a file called do_manage2. Should the line instead be:

    from do_manage2 import im_dist
    

    Thanks!

    opened by parsotat 20
  • Residual batml updates

    Residual batml updates

    Added in some updates I've done in the private repo.

    do_manage2.py -

    • Made it so that long ssh cmds are split up (there's a limit to length)
    • added a --q arg to pass to sub_jobs, which is needed to submit jobs to the virtual queue
    • create started directories to put files in that say if each seed has been started for in and out of FoV LLH jobs

    do_llh_inFoV4realtime2.py -

    • Made it so that each job, when it starts processing a seed, will create a file saying it has started
    • Skips and seed that has already been started
    • Each job, after it has finished its own seeds will check the other jobs' seeds to see if they have been started, and if not, will run them

    do_llh_oFoV4realtime2.py -

    • Made it so that each job, when it starts processing a seed, will create a file saying it has started
    • Skips and seed that has already been started
    • Each job, after it has finished its own seeds will check the other jobs' seeds to see if they have been started, and if not, will run them

    do_rates_mle_InOutFoV2.py -

    • Made it so that it doesn't crash if there's no partial coding image to use

    pyscript_template_rhel7.pbs -

    • Added arg pmem, which give memory per processor and lets the multi-core bkg job have more memory
    opened by jjd330 12
  • optimized model and LLH, slight response speed up

    optimized model and LLH, slight response speed up

    Added model, LLH, and response optimizations. Changed LLH in FoV script to use these updates. Everything is python 3 compatible and tested in python 3.10. Individual parts have been testes and a whole analysis has been run with no errors.
    See summary of changes below.

    Changes in LLH.py

    • Added a LLH_webins2 class with updates to LLH_webins
    • Works the same as LLH_webins, but expects the error to be error^2 instead of error
    • Has added support for models that return counts instead of rates (less multiplications)
    • Caches data dpis and other data products selected for certain time bins in a dictionary so they don't have to be remade
    • Added new pois_norm_conv_n*2 functions that take error^2 and are optimized to do less logs and exps

    Changes in models.py

    • Made it so Source_Model_InOutFoV caches the normalized photon fluxes for each set of spectral params so it doesn't recalculate it every time set_flux_params is called.
    • New model, Sig_Bkg_Model added.
    • It takes an already made bkg model (any model is fine, that keeps all of it's parameters fixed), and a Source_Model_InOutFoV model.
    • Model only has one parameter, "A" that's used to update the signal DPIs in the Source_Model_InOutFoV model while keeping all other internal parameters fixed, bypassing calling any of the bkg models and keeping the bkg DPIs cached.
    • Also has new functions that return count DPIs instead of rate DPIs, that LLH_webins2 uses and saves time by not doing time exposure every LLH eval.
    • Also has new functions to get error DPIs squared, saves time by not doing the square root. LLH_webins2 support these new functions.

    Changes in do_llh_inFoV4realtime2.py

    • Added the new model, Sig_Bkg_Model and LLH object, LLH_webins2.
    • Changed how parameters and set and updated to reflect the new model used.

    Changes in response.py

    • removed 2 unnecessary additions of large arrays in calc_tot_resp_dpis.
    enhancement 
    opened by jjd330 7
  • Updated files/jupyter notebooks to be compatible with python3.

    Updated files/jupyter notebooks to be compatible with python3.

    I have updated the jupyter and python files to be compatible with python3. I have also changed some imports to also be compatible with python 3 (while retaining compatibility with python2).

    opened by parsotat 5
  • Example_Reading_Results Notebook Error

    Example_Reading_Results Notebook Error

    When running the Example_Reading_Results.ipynb, I run into an error in the 13th cell where the function get_rate_res_fnames() is not finding any files with 'rates' in the name. It is searching in the F646018360/ directory and there are none of these files in the repo. Are they supposed to be there or included with the Zenodo data files?

    opened by parsotat 3
  • Making NITRATES Pip Installable

    Making NITRATES Pip Installable

    opened by parsotat 2
  • Separate out operations code from analysis

    Separate out operations code from analysis

    Listening for alerts, downloading data, should all be removed from the NITRATES repo and developed in a separate repo. This repo (Conductor or Orchestrator or...) should import NITRATES code (after https://github.com/Swift-BAT/NITRATES/pull/7 is merged) and run the analyses.

    opened by Tohuvavohu 0
  • Using Jamie's API to get data

    Using Jamie's API to get data

    Currently many cronjobs in the data_scraping folder are used to constantly download all the data. This is overkill and also often breaks. We should instead use Jamie's API to find and download the data, most likely inside of do_data_setup.py . This would also make it much easier to run NITRATES elsewhere.

    good first issue 
    opened by jjd330 0
  • Using new, efficient model and LLH object for out of FoV analysis

    Using new, efficient model and LLH object for out of FoV analysis

    The new model, Sig_Bkg_Model and new LLH object LLH_webins2 that were made and merged here #9 , were only applied to the in FoV analysis in script do_llh_inFoV4realtime2.py . To apply it to the out of FoV analysis similar changes will need to be made to the script do_llh_outFoV4realtime2.py. The changes being using LLH_webins2 instead of LLH_webins and using Sig_Bkg_Model instead of the usual compound model to combine the signal and bkg models. Along with the new way to set the bkg and signal parameters.

    opened by jjd330 2
  • Making NITRATES Pip Installable

    Making NITRATES Pip Installable

    opened by parsotat 1
  • Creating Automated Testing Pipeline

    Creating Automated Testing Pipeline

    There are a few things that we need to think about in order to start implementing automated testing. These are:

    1. What are the things that we need to test? We definitely want to test the llh calculation and the bkg estimation, what else?
    2. Can we create any codes that are self-contained to test the points in item 1?
    3. What GRB do we want to make the default test case that we test everything against?
    opened by parsotat 9
Releases(v0.0.0)
This repository contains the code for "Self-Diagnosis and Self-Debiasing: A Proposal for Reducing Corpus-Based Bias in NLP".

Self-Diagnosis and Self-Debiasing This repository contains the source code for Self-Diagnosis and Self-Debiasing: A Proposal for Reducing Corpus-Based

Timo Schick 62 Dec 12, 2022
Multispectral Object Detection with Yolov5

Multispectral-Object-Detection Intro Official Code for Cross-Modality Fusion Transformer for Multispectral Object Detection. Multispectral Object Dete

Richard Fang 121 Jan 01, 2023
The implementation of the paper "HIST: A Graph-based Framework for Stock Trend Forecasting via Mining Concept-Oriented Shared Information".

The HIST framework for stock trend forecasting The implementation of the paper "HIST: A Graph-based Framework for Stock Trend Forecasting via Mining C

Wentao Xu 110 Dec 27, 2022
Code for the Shortformer model, from the paper by Ofir Press, Noah A. Smith and Mike Lewis.

Shortformer This repository contains the code and the final checkpoint of the Shortformer model. This file explains how to run our experiments on the

Ofir Press 138 Apr 15, 2022
Our solution for SSN Invente 2021's Hackathon

Our solution for SSN Invente 2021's Hackathon. To help maitain godowns in a pristine and safe condition using raspberry pi.

1 Jan 12, 2022
A Python library that provides a simplified alternative to DBAPI 2

A Python library that provides a simplified alternative to DBAPI 2. It provides a facade in front of DBAPI 2 drivers.

Tony Locke 44 Nov 17, 2021
The code for the NSDI'21 paper "BMC: Accelerating Memcached using Safe In-kernel Caching and Pre-stack Processing".

BMC The code for the NSDI'21 paper "BMC: Accelerating Memcached using Safe In-kernel Caching and Pre-stack Processing". BibTex entry available here. B

Orange 383 Dec 16, 2022
LONG-TERM SERIES FORECASTING WITH QUERYSELECTOR – EFFICIENT MODEL OF SPARSEATTENTION

Query Selector Here you can find code and data loaders for the paper https://arxiv.org/pdf/2107.08687v1.pdf . Query Selector is a novel approach to sp

MORAI 62 Dec 17, 2022
Implementation of Memformer, a Memory-augmented Transformer, in Pytorch

Memformer - Pytorch Implementation of Memformer, a Memory-augmented Transformer, in Pytorch. It includes memory slots, which are updated with attentio

Phil Wang 60 Nov 06, 2022
AgeGuesser: deep learning based age estimation system. Powered by EfficientNet and Yolov5

AgeGuesser AgeGuesser is an end-to-end, deep-learning based Age Estimation system, presented at the CAIP 2021 conference. You can find the related pap

5 Nov 10, 2022
Unsupervised Image-to-Image Translation

UNIT: UNsupervised Image-to-image Translation Networks Imaginaire Repository We have a reimplementation of the UNIT method that is more performant. It

Ming-Yu Liu 劉洺堉 1.9k Dec 26, 2022
Starter Code for VALUE benchmark

StarterCode for VALUE Benchmark This is the starter code for VALUE Benchmark [website], [paper]. This repository currently supports all baseline model

VALUE Benchmark 73 Dec 09, 2022
This repository contains code to run experiments in the paper "Signal Strength and Noise Drive Feature Preference in CNN Image Classifiers."

Signal Strength and Noise Drive Feature Preference in CNN Image Classifiers This repository contains code to run experiments in the paper "Signal Stre

0 Jan 19, 2022
SporeAgent: Reinforced Scene-level Plausibility for Object Pose Refinement

SporeAgent: Reinforced Scene-level Plausibility for Object Pose Refinement This repository implements the approach described in SporeAgent: Reinforced

Dominik Bauer 5 Jan 02, 2023
Contenido del curso Bases de datos del DCC PUC versión 2021-2

IIC2413 - Bases de Datos Tabla de contenidos Equipo Profesores Ayudantes Contenidos Calendario Evaluaciones Resumen de notas Foro Política de integrid

54 Nov 23, 2022
Rethinking the Importance of Implementation Tricks in Multi-Agent Reinforcement Learning

RIIT Our open-source code for RIIT: Rethinking the Importance of Implementation Tricks in Multi-AgentReinforcement Learning. We implement and standard

405 Jan 06, 2023
Processed, version controlled history of Minecraft's generated data and assets

mcmeta Processed, version controlled history of Minecraft's generated data and assets Repository structure Each of the following branches has a commit

Misode 75 Dec 28, 2022
Create Own QR code with Python

Create-Own-QR-code Create Own QR code with Python SO guys in here, you have to install pyqrcode 2. open CMD and type python -m pip install pyqrcode

JehanKandy 10 Jul 13, 2022
CHERRY is a python library for predicting the interactions between viral and prokaryotic genomes

CHERRY is a python library for predicting the interactions between viral and prokaryotic genomes. CHERRY is based on a deep learning model, which consists of a graph convolutional encoder and a link

Kenneth Shang 12 Dec 15, 2022
Neural-fractal - Create Fractals Using Complex-Valued Neural Networks!

Neural Fractal Create Fractals Using Complex-Valued Neural Networks! Home Page Features Define Dynamical Systems Using Complex-Valued Neural Networks

Amirabbas Asadi 10 Dec 17, 2022