sn-nacl


Namesn-nacl JSON
Version 0.7.1 PyPI version JSON
download
home_pageNone
SummarySN modeling package
upload_time2024-10-11 09:01:45
maintainerNone
docs_urlNone
authorGuy Augarde
requires_python>=3.9
licenseMIT License Copyright (c) 2024 Nicolas Regnault 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.
keywords astronomy astrophysics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # NaCl

[![PyPI - Version](https://img.shields.io/pypi/v/sn-nacl.svg)](https://pypi.org/project/sn-nacl)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sn-nacl.svg)](https://pypi.org/project/sn-nacl)
![coverage](https://gitlab.in2p3.fr/lemaitre/sn-nacl/badges/master/coverage.svg)


> **:warning: This code is still under development and cannot be considered stable**

The `NaCl` package contains code to develop and train type Ia supernova
spectrophotometric models. NaCl can train hybrid models, i.e. models trained
simultaneously on lightcurves, spectral and/or, optionaly, spectrophotometric
data, such as the spectrophotometric sequences published by the SNfactory
collaboration.

As of today, `NaCl` contains:

- a re-implementation of the SALT2 model and error model (Guy et al, 2007,
  2010), with various improvements to make sure that the training can be
  performed in one single minimization

- classes to manage a hybrid (light curves + spectra + photometric spectra)
  training sample

- a minimization framework that is able to minize a log-likelihood function,
  along with quadratic constraints (optional) and quadratic regularization
  penalities (optional). It is also possible to fit a fairly general error model
  simultaneously.


**Table of Contents**

- [Installation](#installation)
- [Getting started](#getting started)
- [Troubleshooting](#troubleshooting)
- [License](#license)


# Installation

## virtual environments

We recommend using `conda` which comes with a compiled version of `suitesparse`.
`venv` is also a suitable option if suitesparse is already installed on your
machine, or if you are ready to compile it yourself (on Debian/Unbuntu, just
have a `sudo apt install libsuitesparse-dev`).

As a reminder:

```bash
conda create -n MY_ENV
conda activate MY_ENV
```

or:

```bash
python -m venv MY_ENV
source MY_ENV/bin/activate
```

## Prerequisites

conda packages for `sn-nacl` are in preparation (but not ready yet). If you are
working within a conda environnment, we recommend that you install these conda
packages first:

```bash
conda install bbf ipython numpy numba scipy matplotlib scikit-sparse pandas h5py pyarrow
```

The `mkl` library can enhance training speed. While it is not a requirement, we
recommend installing it if you are using an Intel platform:

```bash
conda install mkl sparse_dot_mkl
```

Until our changes are merged in sncosmo, we use a modified version of it:

```bash
pip install git+https://github.com/nregnault/sncosmo.git
```


## Installing NaCl

``` bash
pip install sn-nacl
```

or, if you prefer installing it from sources:

```bash
git clone https://gitlab.in2p3.fr/lemaitre/sn-nacl
cd sn-nacl
pip install -e .
```


## Running the tests

```bash
pip install .[test]
pytest
```

## Building the documentation

```bash
pip install -e .[doc]
cd docs
make html  # for example, type "make" for a list of targets
```

Then the documenation is available at `docs/build/html/index.html`

# Getting started

TBD

# Troubleshooting

## Dealing with scikit-sparse

`NaCl` depends on the python bindings to the `cholmod` package, distributed with
the `scikit-sparse` package. In most cases, `scikit-sparse` will be fetched
automatically and installed without any problem. However, depending on your
version of python the installation may crash for various reasons:

- The package needs numpy to be installed already (and doesn't fetch it
  automatically if missing).

- The packages needs `cython` : `pip install cython` should solve the problem.

- Finally, `libsuitesparse` should also be available on your system. On a debian
  or ubuntu system: `sudo apt-get install libsuitesparse-dev` should suffice. On
  Fedora/CentOS the equivalent is `sudo yum install libsuitesparse-devel`.
  Otherwise, an alternative is to to the [SuiteSparse
  repository](https://github.com/DrTimothyAldenDavis/SuiteSparse), clone it and
  follow the installation instructions.

- Also, for `python>=3.10`, the pip installation of scikit-sparse may complain
  about various things and stops. If you encounter this kind of problem, this
  longer install sequence should work:

  ```bash
  pip install numpy
  git clone https://github.com/scikit-sparse/scikit-sparse.git
  cd scikit-sparse; python setup.py install; cd ..
  pip install sn-nacl
  ```

# License

`sn-nacl` is distributed under the terms of the
[MIT](https://spdx.org/licenses/MIT.html) license.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sn-nacl",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "astronomy, astrophysics",
    "author": "Guy Augarde",
    "author_email": "Nicolas Regnault <nicolas.regnault@lpnhe.in2p3.fr>",
    "download_url": "https://files.pythonhosted.org/packages/69/c8/6165f66016bcf1bb359404813d229644ff5a1a5744d600937d8cacf1ec4d/sn_nacl-0.7.1.tar.gz",
    "platform": null,
    "description": "# NaCl\n\n[![PyPI - Version](https://img.shields.io/pypi/v/sn-nacl.svg)](https://pypi.org/project/sn-nacl)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sn-nacl.svg)](https://pypi.org/project/sn-nacl)\n![coverage](https://gitlab.in2p3.fr/lemaitre/sn-nacl/badges/master/coverage.svg)\n\n\n> **:warning: This code is still under development and cannot be considered stable**\n\nThe `NaCl` package contains code to develop and train type Ia supernova\nspectrophotometric models. NaCl can train hybrid models, i.e. models trained\nsimultaneously on lightcurves, spectral and/or, optionaly, spectrophotometric\ndata, such as the spectrophotometric sequences published by the SNfactory\ncollaboration.\n\nAs of today, `NaCl` contains:\n\n- a re-implementation of the SALT2 model and error model (Guy et al, 2007,\n  2010), with various improvements to make sure that the training can be\n  performed in one single minimization\n\n- classes to manage a hybrid (light curves + spectra + photometric spectra)\n  training sample\n\n- a minimization framework that is able to minize a log-likelihood function,\n  along with quadratic constraints (optional) and quadratic regularization\n  penalities (optional). It is also possible to fit a fairly general error model\n  simultaneously.\n\n\n**Table of Contents**\n\n- [Installation](#installation)\n- [Getting started](#getting started)\n- [Troubleshooting](#troubleshooting)\n- [License](#license)\n\n\n# Installation\n\n## virtual environments\n\nWe recommend using `conda` which comes with a compiled version of `suitesparse`.\n`venv` is also a suitable option if suitesparse is already installed on your\nmachine, or if you are ready to compile it yourself (on Debian/Unbuntu, just\nhave a `sudo apt install libsuitesparse-dev`).\n\nAs a reminder:\n\n```bash\nconda create -n MY_ENV\nconda activate MY_ENV\n```\n\nor:\n\n```bash\npython -m venv MY_ENV\nsource MY_ENV/bin/activate\n```\n\n## Prerequisites\n\nconda packages for `sn-nacl` are in preparation (but not ready yet). If you are\nworking within a conda environnment, we recommend that you install these conda\npackages first:\n\n```bash\nconda install bbf ipython numpy numba scipy matplotlib scikit-sparse pandas h5py pyarrow\n```\n\nThe `mkl` library can enhance training speed. While it is not a requirement, we\nrecommend installing it if you are using an Intel platform:\n\n```bash\nconda install mkl sparse_dot_mkl\n```\n\nUntil our changes are merged in sncosmo, we use a modified version of it:\n\n```bash\npip install git+https://github.com/nregnault/sncosmo.git\n```\n\n\n## Installing NaCl\n\n``` bash\npip install sn-nacl\n```\n\nor, if you prefer installing it from sources:\n\n```bash\ngit clone https://gitlab.in2p3.fr/lemaitre/sn-nacl\ncd sn-nacl\npip install -e .\n```\n\n\n## Running the tests\n\n```bash\npip install .[test]\npytest\n```\n\n## Building the documentation\n\n```bash\npip install -e .[doc]\ncd docs\nmake html  # for example, type \"make\" for a list of targets\n```\n\nThen the documenation is available at `docs/build/html/index.html`\n\n# Getting started\n\nTBD\n\n# Troubleshooting\n\n## Dealing with scikit-sparse\n\n`NaCl` depends on the python bindings to the `cholmod` package, distributed with\nthe `scikit-sparse` package. In most cases, `scikit-sparse` will be fetched\nautomatically and installed without any problem. However, depending on your\nversion of python the installation may crash for various reasons:\n\n- The package needs numpy to be installed already (and doesn't fetch it\n  automatically if missing).\n\n- The packages needs `cython` : `pip install cython` should solve the problem.\n\n- Finally, `libsuitesparse` should also be available on your system. On a debian\n  or ubuntu system: `sudo apt-get install libsuitesparse-dev` should suffice. On\n  Fedora/CentOS the equivalent is `sudo yum install libsuitesparse-devel`.\n  Otherwise, an alternative is to to the [SuiteSparse\n  repository](https://github.com/DrTimothyAldenDavis/SuiteSparse), clone it and\n  follow the installation instructions.\n\n- Also, for `python>=3.10`, the pip installation of scikit-sparse may complain\n  about various things and stops. If you encounter this kind of problem, this\n  longer install sequence should work:\n\n  ```bash\n  pip install numpy\n  git clone https://github.com/scikit-sparse/scikit-sparse.git\n  cd scikit-sparse; python setup.py install; cd ..\n  pip install sn-nacl\n  ```\n\n# License\n\n`sn-nacl` is distributed under the terms of the\n[MIT](https://spdx.org/licenses/MIT.html) license.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Nicolas Regnault  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. ",
    "summary": "SN modeling package",
    "version": "0.7.1",
    "project_urls": {
        "Changelog": "https://gitlab.in2p3.fr/lemaitre/sn-nacl/-/blob/main/CHANGELOG.md",
        "Homepage": "https://gitlab.in2p3.fr/lemaitre/sn-nacl",
        "Repository": "https://gitlab.in2p3.fr/lemaitre/sn-nacl"
    },
    "split_keywords": [
        "astronomy",
        " astrophysics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "69c86165f66016bcf1bb359404813d229644ff5a1a5744d600937d8cacf1ec4d",
                "md5": "b71fa99a6ca34bace7fcb3a1101bd2da",
                "sha256": "e7e0cb994e523a2dbd210310f4fca1094f382fd73345b79bdca52f1df535c26c"
            },
            "downloads": -1,
            "filename": "sn_nacl-0.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b71fa99a6ca34bace7fcb3a1101bd2da",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 104641,
            "upload_time": "2024-10-11T09:01:45",
            "upload_time_iso_8601": "2024-10-11T09:01:45.184500Z",
            "url": "https://files.pythonhosted.org/packages/69/c8/6165f66016bcf1bb359404813d229644ff5a1a5744d600937d8cacf1ec4d/sn_nacl-0.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-11 09:01:45",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sn-nacl"
}
        
Elapsed time: 0.43967s