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)
MPI Interest Group on Algorithms on 1st semester 2021

MPI Algorithms Interest Group Introduction Lecturer: Steve Yan Location: TBA Time Schedule: TBA Semester: 1 Useful URLs Typora: https://typora.io Goog

Ex10si0n 13 Sep 08, 2022
Parametric Contrastive Learning (ICCV2021)

Parametric-Contrastive-Learning This repository contains the implementation code for ICCV2021 paper: Parametric Contrastive Learning (https://arxiv.or

DV Lab 156 Dec 21, 2022
Implementation of UNET architecture for Image Segmentation.

Semantic Segmentation using UNET This is the implementation of UNET on Carvana Image Masking Kaggle Challenge About the Dataset This dataset contains

Anushka agarwal 4 Dec 21, 2021
Group-Free 3D Object Detection via Transformers

Group-Free 3D Object Detection via Transformers By Ze Liu, Zheng Zhang, Yue Cao, Han Hu, Xin Tong. This repo is the official implementation of "Group-

Ze Liu 213 Dec 07, 2022
iBOT: Image BERT Pre-Training with Online Tokenizer

Image BERT Pre-Training with iBOT Official PyTorch implementation and pretrained models for paper iBOT: Image BERT Pre-Training with Online Tokenizer.

Bytedance Inc. 435 Jan 06, 2023
Boston House Prediction Valuation Tool

Boston-House-Prediction-Valuation-Tool From Below Anlaysis The Valuation Tool is Designed Correlation Matrix Regrssion Analysis Between Target Vs Pred

0 Sep 09, 2022
Source code for the ACL-IJCNLP 2021 paper entitled "T-DNA: Taming Pre-trained Language Models with N-gram Representations for Low-Resource Domain Adaptation" by Shizhe Diao et al.

T-DNA Source code for the ACL-IJCNLP 2021 paper entitled Taming Pre-trained Language Models with N-gram Representations for Low-Resource Domain Adapta

shizhediao 17 Dec 22, 2022
Offical implementation for "Trash or Treasure? An Interactive Dual-Stream Strategy for Single Image Reflection Separation".

Trash or Treasure? An Interactive Dual-Stream Strategy for Single Image Reflection Separation (NeurIPS 2021) by Qiming Hu, Xiaojie Guo. Dependencies P

Qiming Hu 31 Dec 20, 2022
Converts given image (png, jpg, etc) to amogus gif.

Image to Amogus Converter Converts given image (.png, .jpg, etc) to an amogus gif! Usage Place image in the /target/ folder (or anywhere realistically

Hank Magan 1 Nov 24, 2021
Official codebase for Pretrained Transformers as Universal Computation Engines.

universal-computation Overview Official codebase for Pretrained Transformers as Universal Computation Engines. Contains demo notebook and scripts to r

Kevin Lu 210 Dec 28, 2022
Elegy is a framework-agnostic Trainer interface for the Jax ecosystem.

Elegy Elegy is a framework-agnostic Trainer interface for the Jax ecosystem. Main Features Easy-to-use: Elegy provides a Keras-like high-level API tha

435 Dec 30, 2022
GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond

GCNet for Object Detection By Yue Cao, Jiarui Xu, Stephen Lin, Fangyun Wei, Han Hu. This repo is a official implementation of "GCNet: Non-local Networ

Jerry Jiarui XU 1.1k Dec 29, 2022
Chainer Implementation of Semantic Segmentation using Adversarial Networks

Semantic Segmentation using Adversarial Networks Requirements Chainer (1.23.0) Differences Use of FCN-VGG16 instead of Dilated8 as Segmentor. Caution

Taiki Oyama 99 Jun 28, 2022
The code for SAG-DTA: Prediction of Drug–Target Affinity Using Self-Attention Graph Network.

SAG-DTA The code is the implementation for the paper 'SAG-DTA: Prediction of Drug–Target Affinity Using Self-Attention Graph Network'. Requirements py

Shugang Zhang 7 Aug 02, 2022
Official Pytorch implementation of "Beyond Static Features for Temporally Consistent 3D Human Pose and Shape from a Video", CVPR 2021

TCMR: Beyond Static Features for Temporally Consistent 3D Human Pose and Shape from a Video Qualtitative result Paper teaser video Introduction This r

Hongsuk Choi 215 Jan 06, 2023
A python package for generating, analyzing and visualizing building shadows

pybdshadow Introduction pybdshadow is a python package for generating, analyzing and visualizing building shadows from large scale building geographic

Qing Yu 13 Nov 30, 2022
Multi-Modal Fingerprint Presentation Attack Detection: Evaluation On A New Dataset

PADISI USC Dataset This repository analyzes the PADISI-Finger dataset introduced in Multi-Modal Fingerprint Presentation Attack Detection: Evaluation

USC ISI VISTA Computer Vision 6 Feb 06, 2022
A pre-trained language model for social media text in Spanish

RoBERTuito A pre-trained language model for social media text in Spanish READ THE FULL PAPER Github Repository RoBERTuito is a pre-trained language mo

25 Dec 29, 2022
Code for Blind Image Decomposition (BID) and Blind Image Decomposition network (BIDeN).

arXiv, porject page, paper Blind Image Decomposition (BID) Blind Image Decomposition is a novel task. The task requires separating a superimposed imag

64 Dec 20, 2022
A GUI for Face Recognition, based upon Docker, Tkinter, GPU and a camera device.

Face Recognition GUI This repository is a GUI version of Face Recognition by Adam Geitgey, where e.g. Docker and Tkinter are utilized. All the materia

Kasper Henriksen 6 Dec 05, 2022