Giter Club home page Giter Club logo

bemews's Introduction

BEMEWS: Better Earth Matter Effect calculation With SNEWPY

image Image by dreamstudio.ai

Description

BEMEWS is a python module for calculating the Earth-matter effect on neutrino flavor transformations. It is a standalone module that SNEWPY uses to compute the Earth-Matter Effect for supernova neutrinos. The BEMEWS_example.py script shows how to use the module in standalone mode. The EarthMatter flavor transformation class in SNEWPY is essentially the same script but with the output options turned off.

Installation

BEMEWS is available as a PyPI package and can be installed using

pip install BEMEWS

As of mid-August 2024, installation with pip is only available for Mac users.

If you need or wish to manually install BEMEWS, you can follow the instructions below:

  1. You will need the packages python-devel (in Linux), pybind11, and setuptools

  2. Modify setup.py to use the correct libraries and paths.

  3. To compile enter

sudo python3 setup.py install

  1. If you don't want to sudo you may want to use the option

--install-lib=destination/directory/

Using BEMEWS

  1. The python code BEMEWS.py uses the module to compute the Earth matter effects upon a neutrino signal from Betelgeuse in SuperK. It will generate a lot of files in out folder named in the script. The output can be switched off by changing the outputflag parameter to False.

  2. A script is provided that allows SNEWPY to include the Earth-matter Effect in its flavor transformation prescription.

Troubleshooting

  1. When using BEMEWS you may have to set the PYTHONPATH environment variable to your PWD and/or wherever the BEMEWS module was installed in steps 3) or step 4)

  2. If your script still cannot find the module you may need to put the *.so library in the same directory as the file. The *.so library is in one of the subfolders in the build directory.

  3. BEMEWS uses OpenMP. You may want to set the OMP_NUM_THREADS environment variable to a number suitable for your machine.

  4. During compilation, you may need to set the LIBOMP_INCLUDE variable to enable the build. If you are a homebrew user on Mac OS X, you can do this with the command

export LIBOMP_INCLUDE=`brew --prefix libomp`/include

bemews's People

Contributors

jpkneller avatar jostmigenda avatar sybenzvi avatar

Stargazers

 avatar

Watchers

Chris Tunnell avatar Andrey Sheshukov avatar  avatar Kate Scholberg avatar J Tseng avatar Alec Habig avatar  avatar

bemews's Issues

clean up non-standard C++ elements in calculations

It looks like there are some non-standard C++ calls in the code that will cause problems for some compilers. Two examples identified by @sanyaarora:

  1. The code assumes M_PI is defined in the math header but this is a non-standard math extension.
  2. In src/BEMEWS/_ext/mstl/math2/analysis/runge kutta.cpp the compiler on her machine is choking on the line static const double b0[]={}; with the error that she cannot allocate an empty array. I also noticed that this allocation seems to implicitly assume the static arrays b0, ..., b5 allocate a contiguous block in memory, which may or may not be respected by all compilers.

There may be other issues that crop up. We'll need people to try installing on windows and linux to get this fully tested and fixed.

add PREM files to sdist/wheel

Right now, the PREM files (PREM.rho.dat and PREM.Ye.dat) are hard-coded in EMEWS_example.py; so the user has to download them and ensure they are in the current working directory.
Going forward, we should add them to the installable package (i.e. sdist or wheel), so users automatically get them when they run pip install. We would then be able to access the files via importlib.resources, similar to the SNOwGLoBES data files.

SNEWPY Integration Example

The README for this repository states "A script is provided that allows SNEWPY to include the Earth-matter Effect in its flavor transformation prescription." If possible, could the name and location of this script be added to the readme? I am having trouble finding it.

Build on Linux and Windows as part of GitHub Actions

In #2, I’ve focussed on getting this to build on macOS; and the workflow is currently skipping Linux and Windows (which I can’t test on my machine).
Ideally, this would only require modifying a single install step per OS, to

  1. install any OS-specific dependencies
  2. export the LIBOMP_INCLUDE environment variable

… and everything else should remain unchanged.
(In practice, I suspect it won’t go quite as smoothly; but we should be able to figure this out.)

@jpkneller and @Sheshuk, I think you said you’d managed to compile EMEWS on those systems? Could you help with this?

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.