Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
niess committed Mar 24, 2020
0 parents commit bcec34c
Show file tree
Hide file tree
Showing 74 changed files with 8,640 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin
share/data
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) Université Clermont Auvergne, CNRS/IN2P3, LPC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
all: bin/gsm bin/skymap

bin/gsm: src/gsm.f
mkdir -p bin
gfortran -w -ffixed-line-length-132 -std=legacy -o $@ $^

bin/skymap: src/skymap.c
mkdir -p bin
gcc $^ -o $@ -Iinclude -O3 -Llib -Wl,-rpath,'$$ORIGIN/../lib' -lchealpix -lm

.PHONY: clean
clean:
rm -rf bin
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Diffuse sky radio noise with GSM

2. Clone this repo & compile `gsm` + `skymap` with the provided
[Makefile](Makefile) as:
```bash
git clone https://github.com/TREND50/skymap
cd skymap
make
```

2. Tabulate the radio signal as frequency using GSM. See
(run-gsm.py)[share/scripts/run-gsm.py].

3. Compute the corresponding antenna noise using the provided effectie area and
`skymap`. See e.g. [compute-skymap.py](share/scripts/compute-skymap.py).

> The results can be checked with the [show-gsm.py](share/scripts/show-gsm.py)
> and [show-skymap.py](share/scripts/show-skymap.py) scripts.
167 changes: 167 additions & 0 deletions include/chealpix.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
/* -----------------------------------------------------------------------------
*
* Copyright (C) 1997-2016 Krzysztof M. Gorski, Eric Hivon, Martin Reinecke,
* Benjamin D. Wandelt, Anthony J. Banday,
* Matthias Bartelmann,
* Reza Ansari & Kenneth M. Ganga
*
*
* This file is part of HEALPix.
*
* HEALPix is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* HEALPix is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HEALPix; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* For more information about HEALPix see http://healpix.sourceforge.net
*
*----------------------------------------------------------------------------*/
/*
* chealpix.h
*/

#ifndef CHEALPIX_H
#define CHEALPIX_H

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

/*! \defgroup chealpix HEALPix C interface
All angles are in radian, all \a theta values are colatitudes, i.e. counted
downwards from the North Pole. \a Nside can be any positive number for
pixelisations in RING scheme; in NEST scheme, they must be powers of 2.
The maximum \a Nside for the traditional interface is 8192; for the
64bit interface it is 2^29.
*/
/*! \{ */

/* -------------------- */
/* Constant Definitions */
/* -------------------- */

#ifndef HEALPIX_NULLVAL
#define HEALPIX_NULLVAL (-1.6375e30)
#endif /* HEALPIX_NULLVAL */

/* pixel operations */
/* ---------------- */
/*! Sets \a *ipix to the pixel number in NEST scheme at resolution \a nside,
which contains the position \a theta, \a phi. */
void ang2pix_nest(long nside, double theta, double phi, long *ipix);
/*! Sets \a *ipix to the pixel number in RING scheme at resolution \a nside,
which contains the position \a theta, \a phi. */
void ang2pix_ring(long nside, double theta, double phi, long *ipix);

/*! Sets \a theta and \a phi to the angular position of the center of pixel
\a ipix in NEST scheme at resolution \a nside. */
void pix2ang_nest(long nside, long ipix, double *theta, double *phi);
/*! Sets \a theta and \a phi to the angular position of the center of pixel
\a ipix in NEST scheme at resolution \a nside. */
void pix2ang_ring(long nside, long ipix, double *theta, double *phi);

/*! Computes the RING pixel index of pixel \a ipnest at resolution \a nside
and returns it in \a *ipring. On error, \a *ipring is set to -1. */
void nest2ring(long nside, long ipnest, long *ipring);
/*! Computes the NEST pixel index of pixel \a ipring at resolution \a nside
and returns it in \a *ipring. On error, \a *ipnest is set to -1. */
void ring2nest(long nside, long ipring, long *ipnest);

/*! Returns \a 12*nside*nside. */
long nside2npix(long nside);
/*! Returns \a sqrt(npix/12) if this is an integer number, otherwise \a -1. */
long npix2nside(long npix);

/*! Computes a normalized Cartesian vector pointing in the same direction as
\a theta, \a phi, and stores it in \a vec. \a vec must point to storage
sufficient for at least three doubles. */
void ang2vec(double theta, double phi, double *vec);
/*! Computes the angles \a *theta and \a *phi describing the same directions
as the Cartesian vector \a vec. \a vec need not be normalized. */
void vec2ang(const double *vec, double *theta, double *phi);

/*! Sets \a *ipix to the pixel number in NEST scheme at resolution \a nside,
which contains the direction described the Cartesian vector \a vec. */
void vec2pix_nest(long nside, const double *vec, long *ipix);
/*! Sets \a *ipix to the pixel number in RING scheme at resolution \a nside,
which contains the direction described the Cartesian vector \a vec. */
void vec2pix_ring(long nside, const double *vec, long *ipix);

/*! Sets \a vec to the Cartesian vector pointing in the direction of the center
of pixel \a ipix in NEST scheme at resolution \a nside. */
void pix2vec_nest(long nside, long ipix, double *vec);
/*! Sets \a vec to the Cartesian vector pointing in the direction of the center
of pixel \a ipix in RING scheme at resolution \a nside. */
void pix2vec_ring(long nside, long ipix, double *vec);

/* operations on Nside values up to 2^29 */

/*! Sets \a *ipix to the pixel number in NEST scheme at resolution \a nside,
which contains the position \a theta, \a phi. */
void ang2pix_nest64(int64_t nside, double theta, double phi, int64_t *ipix);
/*! Sets \a *ipix to the pixel number in RING scheme at resolution \a nside,
which contains the position \a theta, \a phi. */
void ang2pix_ring64(int64_t nside, double theta, double phi, int64_t *ipix);

/*! Sets \a theta and \a phi to the angular position of the center of pixel
\a ipix in NEST scheme at resolution \a nside. */
void pix2ang_nest64(int64_t nside, int64_t ipix, double *theta, double *phi);
/*! Sets \a theta and \a phi to the angular position of the center of pixel
\a ipix in RING scheme at resolution \a nside. */
void pix2ang_ring64(int64_t nside, int64_t ipix, double *theta, double *phi);

/*! Computes the RING pixel index of pixel \a ipnest at resolution \a nside
and returns it in \a *ipring. On error, \a *ipring is set to -1. */
void nest2ring64(int64_t nside, int64_t ipnest, int64_t *ipring);
/*! Computes the NEST pixel index of pixel \a ipring at resolution \a nside
and returns it in \a *ipring. On error, \a *ipnest is set to -1. */
void ring2nest64(int64_t nside, int64_t ipring, int64_t *ipnest);

/*! Returns \a 12*nside*nside. */
int64_t nside2npix64(int64_t nside);
/*! Returns \a sqrt(npix/12) if this is an integer number, otherwise \a -1. */
long npix2nside64(int64_t npix);

/*! Sets \a *ipix to the pixel number in NEST scheme at resolution \a nside,
which contains the direction described the Cartesian vector \a vec. */
void vec2pix_nest64(int64_t nside, const double *vec, int64_t *ipix);
/*! Sets \a *ipix to the pixel number in RING scheme at resolution \a nside,
which contains the direction described the Cartesian vector \a vec. */
void vec2pix_ring64(int64_t nside, const double *vec, int64_t *ipix);

/*! Sets \a vec to the Cartesian vector pointing in the direction of the center
of pixel \a ipix in NEST scheme at resolution \a nside. */
void pix2vec_nest64(int64_t nside, int64_t ipix, double *vec);
/*! Sets \a vec to the Cartesian vector pointing in the direction of the center
of pixel \a ipix in RING scheme at resolution \a nside. */
void pix2vec_ring64(int64_t nside, int64_t ipix, double *vec);

/* FITS operations */
/* --------------- */

float *read_healpix_map (const char *infile, long *nside, char *coordsys,
char *ordering);

void write_healpix_map (const float *signal, long nside, const char *filename,
char nest, const char *coordsys);

long get_fits_size(const char *filename, long *nside, char *ordering);

/*! \} */

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* CHEALPIX_H */
Loading

0 comments on commit bcec34c

Please sign in to comment.