Giter VIP home page Giter VIP logo

polarizedstacker's Introduction

PolarizedStacker

Polarized Snapshot Image Hierarchical Stacking

This package will read in a number of eht-imaging snapshot files and stack the posteriors together using an approximate hierarchical modeling scheme. Please see EHTC IV SgrA* for more information.

Installation

To install this package you need to first have a local version of Julia. To install Julia I recommend the juliaup package https://github.com/JuliaLang/juliaup and installing the Julia 1.8 series juliaup add 1.8.5. Once Julia is installed clone the repo and you should be good to go.

Running the script

To run the stacker you need to run

juila -p NCORES main.jl directorylist priors_list.txt

where

  • NCORES is the number of cores you wish to use. Note we parallelize on the list of directories in directorylist so NCORES should be fewer than the number of directories
  • directorylist is a file where each line is a path to the directory of the folder of the snapshot results. For instance if fitting two separate models directorylist would be
        /path/to/model1/directory
        /path/to/model2/directory
    
    an example can be found in listdir. We recommend that all runs or data are place in the Data/ folder.
  • priors_list.txt a text file with the list of priors and parameter names used. Two example priors are included (priors_example_mring_m_stokesi_2_m_lp_3_add_floor=False.txt and priors_example_mring_m_stokesi_2_m_lp_3_m_cp_1_add_floor=False.txt). Note that any "distance" variables e.g. diameter and width have to be in the same units as the chain files. For instance usually the chain files are in $\mu$as and so the priors also have to be in $\mu$as.

The output of the stacking will be in directorylist/StackedResults and will contain

  1. stacker_chain.h5 which is a HDF5 file that groups all the snapshot results together
  2. stacker_chain_ha_trunc.csv which is a CSV file containing the chain of the results. Note this is the entire chain I would typically just recommend taking the last quarter of it for parameter inference.
  3. stacker_chain_ckpt.jld2 is the checkpoint file for sampling that can be used to restart the script.

Post-processing

To post-process the images we have included a postprocess script that will convert a stacker result to a set of images. To run this do

julia postprocess.jl "path/to/stacker_chain_ha_trunc.csv" "path/to/output/directory" "path/to/prior_list.txt" 

if the results are for a linear polarized images and

julia postprocess.jl "path/to/stacker_chain_ha_trunc.csv" "path/to/output/directory" "path/to/prior_list" -c

for a circularly polarized image. By default this will produce 500 fits images in the output directory, but this can be changed with the -n option.

polarizedstacker's People

Contributors

ptiede avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.