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)
Official PyTorch implemention of our paper "Learning to Rectify for Robust Learning with Noisy Labels".

WarPI The official PyTorch implemention of our paper "Learning to Rectify for Robust Learning with Noisy Labels". Run python main.py --corruption_type

Haoliang Sun 3 Sep 03, 2022
(ICCV 2021) PyTorch implementation of Paper "Progressive Correspondence Pruning by Consensus Learning"

CLNet (ICCV 2021) PyTorch implementation of Paper "Progressive Correspondence Pruning by Consensus Learning" [project page] [paper] Citing CLNet If yo

Chen Zhao 22 Aug 26, 2022
Few-Shot Object Detection via Association and DIscrimination

Few-Shot Object Detection via Association and DIscrimination Code release of our NeurIPS 2021 paper: Few-Shot Object Detection via Association and DIs

Cao Yuhang 49 Dec 18, 2022
A project which aims to protect your privacy using inexpensive hardware and easily modifiable software

Protecting your privacy using an ESP32, an IR sensor and a python script This project, which I personally call the "never-gonna-catch-me-in-the-act-ev

8 Oct 10, 2022
The dataset of tweets pulling from Twitters with keyword: Hydroxychloroquine, location: US, Time: 2020

HCQ_Tweet_Dataset: FREE to Download. Keywords: HCQ, hydroxychloroquine, tweet, twitter, COVID-19 This dataset is associated with the paper "Understand

2 Mar 16, 2022
A simple library that implements CLIP guided loss in PyTorch.

pytorch_clip_guided_loss: Pytorch implementation of the CLIP guided loss for Text-To-Image, Image-To-Image, or Image-To-Text generation. A simple libr

Sergei Belousov 74 Dec 26, 2022
Code for CVPR 2021 paper TransNAS-Bench-101: Improving Transferrability and Generalizability of Cross-Task Neural Architecture Search.

TransNAS-Bench-101 This repository contains the publishable code for CVPR 2021 paper TransNAS-Bench-101: Improving Transferrability and Generalizabili

Yawen Duan 17 Nov 20, 2022
Hierarchical Motion Encoder-Decoder Network for Trajectory Forecasting (HMNet)

Hierarchical Motion Encoder-Decoder Network for Trajectory Forecasting (HMNet) Our paper: https://arxiv.org/abs/2111.13324 We will release the complet

15 Oct 17, 2022
Predicting 10 different clothing types using Xception pre-trained model.

Predicting-Clothing-Types Predicting 10 different clothing types using Xception pre-trained model from Keras library. It is reimplemented version from

AbdAssalam Ahmad 3 Dec 29, 2021
Iowa Project - My second project done at General Assembly, focused on feature engineering and understanding Linear Regression as a concept

Project 2 - Ames Housing Data and Kaggle Challenge PROBLEM STATEMENT Inferring or Predicting? What's more valuable for a housing model? When creating

Adam Muhammad Klesc 1 Jan 03, 2022
Transport Mode detection - can detect the mode of transport with the help of features such as acceeration,jerk etc

title emoji colorFrom colorTo sdk app_file pinned Transport_Mode_Detector 🚀 purple yellow gradio app.py false Configuration title: string Display tit

Nishant Rajadhyaksha 3 Jan 16, 2022
CVPR2021: Temporal Context Aggregation Network for Temporal Action Proposal Refinement

Temporal Context Aggregation Network - Pytorch This repo holds the pytorch-version codes of paper: "Temporal Context Aggregation Network for Temporal

Zhiwu Qing 63 Sep 27, 2022
基于Flask开发后端、VUE开发前端框架,在WEB端部署YOLOv5目标检测模型

基于Flask开发后端、VUE开发前端框架,在WEB端部署YOLOv5目标检测模型

37 Jan 01, 2023
A Shading-Guided Generative Implicit Model for Shape-Accurate 3D-Aware Image Synthesis

A Shading-Guided Generative Implicit Model for Shape-Accurate 3D-Aware Image Synthesis Figure: Shape-Accurate 3D-Aware Image Synthesis. A Shading-Guid

Xingang Pan 115 Dec 18, 2022
PyTorch implementation of D2C: Diffuison-Decoding Models for Few-shot Conditional Generation.

D2C: Diffuison-Decoding Models for Few-shot Conditional Generation Project | Paper PyTorch implementation of D2C: Diffuison-Decoding Models for Few-sh

Jiaming Song 90 Dec 27, 2022
Raptor-Multi-Tool - Raptor Multi Tool With Python

Promises 🔥 20 Stars and I'll fix every error that there is 50 Stars and we will

Aran 44 Jan 04, 2023
Building blocks for uncertainty-aware cycle consistency presented at NeurIPS'21.

UncertaintyAwareCycleConsistency This repository provides the building blocks and the API for the work presented in the NeurIPS'21 paper Robustness vi

EML Tübingen 19 Dec 12, 2022
This is just a funny project that we want to see AutoEncoder (AE) can actually work to enhance the features we want

Funny_muscle_enhancer :) 1.Discription: This is just a funny project that we want to see AutoEncoder (AE) can actually work on the some features. We w

Jing-Yao Chen (Jacob) 8 Oct 01, 2022
Official implementation of SynthTIGER (Synthetic Text Image GEneratoR) ICDAR 2021

🐯 SynthTIGER: Synthetic Text Image GEneratoR Official implementation of SynthTIGER | Paper | Datasets Moonbin Yim1, Yoonsik Kim1, Han-cheol Cho1, Sun

Clova AI Research 256 Jan 05, 2023
StyleGAN of All Trades: Image Manipulation withOnly Pretrained StyleGAN

StyleGAN of All Trades: Image Manipulation withOnly Pretrained StyleGAN This is the PyTorch implementation of StyleGAN of All Trades: Image Manipulati

360 Dec 28, 2022