{"id":21735133,"url":"https://github.com/caltech-ipac/libhires","last_synced_at":"2025-08-19T11:10:46.461Z","repository":{"id":149118123,"uuid":"43082780","full_name":"Caltech-IPAC/libhires","owner":"Caltech-IPAC","description":"Component for IRSA image reconstruction application","archived":false,"fork":false,"pushed_at":"2022-11-15T21:50:47.000Z","size":2032,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-21T00:22:35.884Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Caltech-IPAC.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-24T17:42:34.000Z","updated_at":"2022-11-10T18:46:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"3ff9a91b-d962-4d24-b9d4-e705f39de7aa","html_url":"https://github.com/Caltech-IPAC/libhires","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Caltech-IPAC/libhires","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Caltech-IPAC%2Flibhires","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Caltech-IPAC%2Flibhires/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Caltech-IPAC%2Flibhires/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Caltech-IPAC%2Flibhires/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Caltech-IPAC","download_url":"https://codeload.github.com/Caltech-IPAC/libhires/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Caltech-IPAC%2Flibhires/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271143398,"owners_count":24706346,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-26T05:12:01.485Z","updated_at":"2025-08-19T11:10:46.402Z","avatar_url":"https://github.com/Caltech-IPAC.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Libhires\n\nlibhires is a C++ image reconstruction library for Time Ordered\nInformation (TOI) data from the Planck satellite.\n\n# Theory\n\nThe basis of all of the algorithms used in libhires is minimap.  This\nsimply bins the TOI's into the output pixels and averages the results\nper pixel.  It does not attempt a true deconvolution, which would\nrequire taking into account the PSF of the detectors at different\nfrequencies.\n\nThe more sophisticated methods take into account the detector specific\nPSF.  They all start by computing a minimap image.  Then they\ndeconvolve that minimap image.  At the boundaries, the PSF can depend\non pixels outside of the data.  To reduce the effect from the edges,\nall of the methods reflect the boundaries.  So\n\n    U(-x) = U(x)\n    U(x_boundary + x) = U(x_boundary - x)\n\nThe basic equation that the deconvolution methods start with is the imaging equation\n\n    b=Ax+N\n\nwhere 'b' is the measured data, 'x' is the true signal, 'A' maps the\nsignal to the measurement using the PSF, and 'N' is the noise.\n\nAll of the deconvolution methods implemented in libhires can be\nunderstood as trying the maximize the Bayesian a posteriori\nprobability P(x|b).  This probability can be expressed in terms of the\nprobability of the measurement given the signal P(b|x) and the prior\nprobability of the signal P(x).\n\n    P(x|b) ~ P(b|x) P(x)\n\nThe probability of the measurement P(b) is unity here.  The\ndifferences between the deconvolution methods arise mainly because\nthey choose different P(b|x) and P(x).\n\n## MCM\n\nMCM stands for the [Maximum Correlation\nMethod](http://labs.adsabs.harvard.edu/adsabs/abs/1990AJ.....99.1674A/).\nThis is also known as the HIRES method for IRAS.\n\nMCM assumes that the noise follows a Poisson distribution.  The prior\nprobability for the signal P(x) is the improper constant distribution\nover the positive numbers.\n\n     P(x) ~ x \u003e0 constant\n            x\u003c=0 0\n\nThese two assumptions require that both the measured flux 'b' and the\nsolution 'x' are positive.  This implies that every pixel of the\nminimap image must be positive.  For data from Planck's high frequency\ndetectors, this is almost always true.  This is less true for the\nlower frequencies.\n\nMCM then iteratively smoothes an initial guess to find a solution.\nThe iteration is constructed so that flux is always conserved.  One\ndefect of this method is that there is no unique solution.  Repeated\niterations can lead to divergent results.  This is a natural\nconsequence of P(x) being a constant.  For many cases, the solution\ndoes not actually wander off to infinity because flux is conserved and\ncan never be negative.  That means that the recovered signal always\ndepends on the resolution of the recovered image.\n\nAlso, the original MCM did not have binning.  We have added binning in\norder to eliminate a bias whereby the recovered signal in regions with\nmore samples would be brighter than regions with fewer samples.\n\nWith that said, MCM is relatively fast, easy to compute, and widely\nused.  It also conserves flux.  It is not clear if that is a good\nthing, since it conserves the flux of the noise.\n\n## Elastic Net\n\n[Elastic Net](https://en.wikipedia.org/wiki/Elastic_net_regularization) starts by assuming the noise follows a Gaussian distribution.  Using only this would give the traditional least-squares solution.  However, this is not sufficient, because this would lead to overfitting.  The solution would become wildly varying in trying to fit the noise.\n\nTo alleviate this, Elastic Net preferentially chooses smaller signals\nby setting the prior probability of the signal to a combination of\nLaplace and Gaussian distributions.\n\n     P(x) ~ exp((x^2)/(2*g^2)) exp(-|x/l|)\n\nThe Gausssian prior makes the recovered solution less prone to large\nvariations.  The Laplacian prior tends to select some regions for\nsignal while setting the rest of the image to zero.\n\nUsing the variance of the measurements\n\n     v=Var(b)\n\ntheir maximum size\n\n     m=max(|b|)\n\nand the ratio of the number of pixels in the measurement 'N_b' and\nrecovered signal 'N_x'\n\n     r=N_b/N_x\n\nwe set the constants 'g' and 'l' as\n\n     g=r*v/(m*m)\n     l=r*v/m\n\nThis results in a matrix that is, in principle, invertible.  In\npractice, we use mlpack's\n[LARS](http://www.mlpack.org/doxygen.php?doc=classmlpack_1_1regression_1_1LARS.html)\nclass to compute a solution.\n\nElastic Net has a well defined solution with relatively few artifacts.\nHowever, it is much, much slower than MCM, making it impractical for\nlarge image reconstructions.\n\n# Implementation\n\nLibhires is written in C++ and depends on\n\n* [mlpack](http://www.mlpack.org/)\n* [armadillo](http://arma.sourceforge.net/).\n* [boost](http://www.boost.org/)\n* [cfitsio](http://heasarc.gsfc.nasa.gov/fitsio/fitsio.html)\n* [CCfits](http://heasarc.gsfc.nasa.gov/fitsio/CCfits/)\n* [libxml2](http://xmlsoft.org/)\n\nLibhires uses C++11 features, and has been tested with gcc versions\n4.7 and 4.9.\n\n# Testing\n\nThere is a simple test program in\n\n  test/deconvolve.cxx\n\nthat gets built into\n\n  build/deconvolve\n\nRunning this compares a deconvolution of a gaussian elliptical\nmeasurement against expected results in\n\n  test/expected/\n\n# License\n\nCopyright © 2012-2015, California Institute of Technology\nAuthors: Walter Landry, Peregrine McGehee, and Angela Zhang\nBased on Government Sponsored Research NAS7-03001 and NNN12AA01C.\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along\nwith this program; if not, write to the Free Software Foundation, Inc.,\n51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaltech-ipac%2Flibhires","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaltech-ipac%2Flibhires","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaltech-ipac%2Flibhires/lists"}