Giter Site home page Giter Site logo

rozanskit / suppnet Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 1.0 169.9 MB

SUPPNet: Neural network for stellar spectrum normalisation

Home Page: https://rozanskit.com/suppnet/

Python 33.44% Jupyter Notebook 66.12% Shell 0.44%
spectroscopy astronomy astronomy-software

suppnet's Introduction

SUPPNet: Neural network for stellar spectrum normalisation


SUPPNet: Neural network for stellar spectrum normalisation
Różański Tomasz1, Niemczura Ewa1, Lemiesz Jakub2, Posiłek Natalia1, Różański Paweł3

Here should be example_run.gif

1. Astronomical Institute, University of Wrocław, Kopernika 11, 51-622 Wrocław, Poland 2. Department of Computer Science, Faculty of Fundamental Problems of Technology, Wrocław University of Science and Technology, Wrocław, Poland 3. Faculty of Electronics, Wrocław University of Science and Technology, Wrocław


Installing Guide

SUPPNet can be istalled in several simple steps. If you want to test SUPPNet on-line version please check the link (recommended Chrome browser).

0. Prerequisites

Install anaconda Python distribution.

1. Download repository

Download suppnet repository by:

git clone https://github.com/RozanskiT/suppnet.git

Now change the directory to suppnet:

cd suppnet

2. Handle requirements

Now create and activate a conda environment suppnet-env that handles all dependencies.

conda env create -f environment.yml
conda activate suppnet-env

Creating symbolic link in local '~/bin/' directory

The package contains the script SUPPNET.sh which enable user to use suppnet from any place in the system by simply calling SUPPNET command. To create symbolic link please make sure that you have local ~/bin directory by running:

ls ~/bin

if you do not have ~/bin directory you can create one by running: mkdir ~/bin. Then create link:

ln -s ${PWD}/SUPPNET.sh ~/bin/SUPPNET

then inspect the result by:

ls -l ~/bin/SUPPNET

you should see something like:

lrwxrwxrwx 1 tr tr 37 wrz 23 11:20 /home/tr/bin/SUPPNET -> /home/tr/repos/suppnet-dev/SUPPNET.sh

Having SUPPNET script installed correctly you do not need to manually activate suppnet-env environment and you can run any commands described in next paragraph. To test if everything runns correctly just run:

SUPPNET

Python script usage

After successful environment creation and linking the script SUPPNET in your personal bin directory you should be able to use SUPPNet. Spectra that you are working with should't have header: the forst column should contain wavelengths in angstroms (nanometers possible but then you need to change the sampling value from default 0.05 to 0.005), the second should contain flux. Start with:

SUPPNET

The program window should pop-up and from now you can normalise your spectra. Typical usage scenarios are:

  1. Spectrum-by-spectrum normalisation using interactive app:
SUPPNET [--segmentation] [--sampling RESAMPLING_STEP=0.05] [--weights WHICH_WEIGHTS=active|synth|emission]
  1. Normalisation of group of spectra without any supervision:
SUPPNET --quiet [--sampling RESAMPLING_STEP=0.05] [--weights WHICH_WEIGHTS=active|synth|emission] [--skip number_of_rows_to_skip=0] path_to_spec_1.txt [path_to_spec_2.txt ...]
  1. Manual inspection and correction of previously normalised spectrum, SUPPNet will not be loaded (often used in pair with 2.):
SUPPNET [--segmentation] --path path_to_processing_results.all

You can always remind yourself the typical usage by writing:

SUPPNET --help

--sampling and --weights options

  • --sampling, default=0.05, sampling option enable user to adjust the resampling that the neural network is using for a pseudo-continuum prediction, (If working with wavelengths in nm should be changed to 0.005),
  • --weights, default=active, set of weights that can be used, active is a default one, emission should be used for objects that show wide emission lines, synth is a weights trained only on synthetic spectra and shouldn't be used.

SUPPNet as python module

You can install and use suppnet as regular Python module. Start from activating appropriate environment, e.g.

conda activate suppnet-env

And then call:

pip install -e .

For an example usage check the notebook in notebooks directory.

suppnet's People

Contributors

rozanskit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

suppnet's Issues

Compute continua for a batch of spectra

Hi there,

Currently I am estimating the continuum for each spectrum separately using

cont, cont_err, seg, seg_err = nn.normalize(wave_grid, spectrum)

However, to make use of the efficiency of the neural network, it would be nice if I could feed a batch of spectra at a time. Would this capability be possible?

Thanks!

Unable to use suppnet

Hii. I have been using suppnet for a few months, but after recently updating my laptop, it stopped working. I have tried installing the suppnet from the beginning, but it is not able to run-
conda env create -f environment.yml

I have also tried to manually build a new conda environment and install the required packages as mentioned in environment.yml, but I couldn't do it because tensorflow==2.4.0 and matplotlib==3.7.1 require two different versions of numpy. Can you please help me resolve this issue?

Cannot run SUPPNET

Hi,

I recently tried to follow the read.me file to install SUPPNET. I created the environment and the symbolic link but when I try to run SUPPNET (either by typing 'SUPPNET' or going to the directory and run 'python3 suppnet.py') this error message appears:

Calling python "/home/trentin/suppnet/suppnet.py"
Traceback (most recent call last):
  File "/home/trentin/suppnet/suppnet.py", line 17, in <module>
    from matplotlib.backends.backend_qt5agg import (
  File "/home/trentin/.local/lib/python3.8/site-packages/matplotlib/backends/backend_qt5agg.py", line 5, in <module>
    from .backend_qtagg import (
  File "/home/trentin/.local/lib/python3.8/site-packages/matplotlib/backends/backend_qtagg.py", line 12, in <module>
    from .backend_qt import (
  File "/home/trentin/.local/lib/python3.8/site-packages/matplotlib/backends/backend_qt.py", line 73, in <module>
    _MODIFIER_KEYS = [
  File "/home/trentin/.local/lib/python3.8/site-packages/matplotlib/backends/backend_qt.py", line 74, in <listcomp>
    (_to_int(getattr(_enum("QtCore.Qt.KeyboardModifier"), mod)),
TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier'

The line in question is:


from matplotlib.backends.backend_qt5agg import (
    FigureCanvasQTAgg as FigureCanvas,
    NavigationToolbar2QT as NavigationToolbar)

But if I try to import this package on python by itself, it works fine.

Thank you in advance.

Suggestions to saving of normalised spectra results

Hi,

Just a small suggestion. Perhaps it would be nice if the top column was saved with a #. Right now it is saved as wave flux normed_flux normed_error, which can cause TOPCAT (especially TOPCAT!) or np.loadtxt (without skiprows) to interpret it as part of the data and thus a string. Maybe changing it to the # wave flux normed_flux normed_error would make it a tiny bit easier to load normalised data without the need to specify first column as a comment every time? Cheers.

P.S. Thanks a lot for switching to PySide6, it works great on my Mac now.

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.