Coder Social home page Coder Social logo

spacetelescope / specviz Goto Github PK

View Code? Open in Web Editor NEW
43.0 12.0 31.0 19.77 MB

An interactive astronomical 1D spectra analysis tool.

Home Page: http://specviz.readthedocs.io

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
astronomy spectroscopy viewer data-analysis python

specviz's Introduction

SpecViz: An interactive astronomical 1D spectra analysis tool

An GUI-based interactive analysis tool for one dimensional astronomical data using Python.

For documentation see https://specviz.readthedocs.io/en/latest/

Current Status

Please note that this version of SpecViz is no longer being actively supported or maintained. The functionality of SpecViz is now available and being actively developed as part of Jdaviz.

If you must use legacy SpecViz, please try v0.7.1 in Python 3.6.

License

This project is Copyright (c) JDADF Developers and licensed under the terms of the BSD 3-Clause license. This package is based upon the Astropy package template which is licensed under the BSD 3-clause licence. See the licenses folder for more information.

specviz's People

Contributors

astrofrog avatar brechmos avatar bsipocz avatar drdavella avatar duytnguyendtn avatar eteq avatar gpernot avatar ibusko avatar javerbukh avatar jhunkeler avatar justincely avatar larrybradley avatar mattjhill avatar mfixstsci avatar nmearl avatar pllim avatar robelgeda avatar rosteen avatar saogaz avatar sosey avatar stscieisenhamer avatar weaverba137 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

specviz's Issues

ImportError qtpy.QtWidgets

Under Anaconda, I am unable to start pyfocal. Am I missing some dependency? qtpy is nothing I have heard of before.

Traceback (most recent call last):
  File ".../bin/pyfocal", line 9, in <module>
    load_entry_point('pyfocal==0.1a1', 'console_scripts', 'pyfocal')()
  File ".../lib/python2.7/site-packages/setuptools-19.6.2-py2.7.egg/pkg_resources/__init__.py", line 547, in load_entry_point
  File ".../lib/python2.7/site-packages/setuptools-19.6.2-py2.7.egg/pkg_resources/__init__.py", line 2719, in load_entry_point
  File ".../lib/python2.7/site-packages/setuptools-19.6.2-py2.7.egg/pkg_resources/__init__.py", line 2379, in load
  File ".../lib/python2.7/site-packages/setuptools-19.6.2-py2.7.egg/pkg_resources/__init__.py", line 2385, in resolve
  File ".../site-packages/pyfocal-0.1a1-py2.7.egg/pyfocal/app.py", line 7, in <module>
    from qtpy.QtWidgets import *
ImportError: No module named qtpy.QtWidgets

Model list names reset after update

Currently, there is no persistence is using custom model names in the model list. That is, they only last until the model list is updated again.

Extend statistics module

Include functions for

Stats that don't require a model

  • Centroid (API implemented in #39 but algorithm needs correcting corrected)
  • Center
  • FWZI (#39)

Stats that require a model

  • FWHM
  • Gaussian sigma (from moments or fitting)

See the statistics module (currently being re purposed from previous sprint).

Rename package to specview

I think this was raised by one of the scientists in the kick off meeting, and agreed by everyone else.

Hook up stats display

Update the gui elements in the "stats" box:

  • when there is an ROI present, update with the stats of the data points inside this ROI
  • when there is no ROI present, update with the stats of the entire data set.

How to ingest user-defined YAML files?

Currently, pyfocal automatically picks up YAML files from interfaces/default_loaders/ package directory. But what if a user has his/her own my_weird_fits_format.yaml definition, then where does it go so that pyfocal also picks it up?

It would be undesirable to have user put it in the installation directory (i.e., in site-packages). A more logical place is to have pyfocal automatically look in ~/.pyfocal/ directory prior to running the GUI, similar to what Ginga is doing for its user configurations and custom plugins.

If pyfocal can already do this, then it is just a matter of documentation. Otherwise, this is a new feature that needs to be implemented.

Ideas for demo videos

As mentioned in sprint tag-up, a short demo video to link/embed in the documentation would be nice. Going forward, there can be even a series of them, each showcasing a different functionality. We can perhaps list some ideas here for that purpose. Each video should not be longer than a few minutes.

As a start, just a basic video showing how to load a single spectrum, select an emission/absorption line, and then fit a Gaussian to it would be nice.

Implement logging

Populate functions with relevant logging, allow user to access logs through either gui or command like (through the pyfocal entry point?)

Allow namespace to be accessible through notebooks

There is a use-case currently where the user wants to be able to be working within an ipython notebook with some data, and be able to

  • call pyfocal from the notebook
  • pass it their data
  • have the gui pop up
  • do some work
  • have the data objects created in pyfocal be available in the notebook

What does "filter" mean in Data.read()?

I am trying to create a pyfocal.core.data.Data object manually, so I can unit test a function. But I cannot figure out what it wants in the "filter".

>>> d = Data.read(filename, filter=None)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-14-07a508ca516c> in <module>()
----> 1 d = Data.read(filename, filter=None)

.../Pyfocal-0.1a1-py2.7.egg/pyfocal/core/data.pyc in read(cls, *args, **kwargs)
     26         from ..interfaces.registries import io_registry
     27 
---> 28         return io_registry.read(cls, *args, **kwargs)
     29 
     30     @property

.../astropy-1.1.1-py2.7-linux-x86_64.egg/astropy/io/registry.pyc in read(cls, *args, **kwargs)
    342 
    343         reader = get_reader(format, cls)
--> 344         data = reader(*args, **kwargs)
    345 
    346         if not isinstance(data, cls):

.../Pyfocal-0.1a1-py2.7.egg/pyfocal/interfaces/loaders.pyc in fits_reader(filename, filter, **kwargs)
     27     name = os.path.basename(filename.name.rstrip(os.sep)).rsplit('.', 1)[0]
     28     hdulist = fits.open(filename, **kwargs)
---> 29     ref = loader_registry.get(filter)
     30 
     31     meta = ref.meta

.../Pyfocal-0.1a1-py2.7.egg/pyfocal/interfaces/registries.pyc in get(self, filter)
     29 
     30     def get(self, filter):
---> 31         return [x for x in self._members if x.filter == filter][0]
     32 
     33     @property

IndexError: list index out of range

Write tests for non-GUI functionalities

For example, we need tests to ensure that the analysis functions give the correct answers. This will also require some basic test data to go with the repo.

Thoughts about statistics module

Looking at extract(), stats(), and eq_width() functions under pyfocal.analysis.statistics, they can just as easily be methods attached to pyfocal.core.data.Data class. This is because they operate with the assumption that input data is already a Data instance anyway.

Something to think about.

Installing pyqt5 with anaconda 2

It appears that you're able to install pyqt5 with an anaconda 2.7 distribution, but it will not install a python 3 distribution simultaneously.

The instructions may need to be updated to indicate that you'll have to have a python 3 virtual environment, or have a system-level python3 installation outside of anaconda in order to run the pyqt5 version.

Implement model fitting

Allow population of model fitting drop-down and running of code to populate the model list objects.

extract() does not work

Data class has neither set_x() nor set_y() implemented.

>>> data
Data([ 0.09934656, -0.02764913,  0.12954146, ...,  0.07568395,  0.34271905, -0.32397091])
>>> extract(data, (10000, 20000))
.../Pyfocal-0.1a1-py2.7.egg/pyfocal/analysis/statistics.pyc in extract(data, x_range)
     25 
     26     result = Data(x[slice])
---> 27     result.set_x(x[slice], unit=spectrum_data.x.unit)
     28     result.set_y(y[slice], unit=spectrum_data.y.unit)
     29 

AttributeError: 'Data' object has no attribute 'set_x'

Data loader for tabular files

Create a registry object for ingesting data files that are e.g. csv, txt, etc. This will require either

  1. Creating a new YAMLLoader class to deal with non-fits styled data, or
  2. Extending the current YAMLLoader to also deal with the tabular data.

See here for details on current implementation.

Needs clarification on layers and ROI

When I select a ROI, I see two layers. Intuitively, the first one would be the original data, and the second one is the one with ROI. But when I select the first one, the plot blurs out the regions outside the ROI (as shown) but does not blur out anything when I select the second layer. What is the logic behind this behavior?

untitled

Write documentation

Documentation needs to be filled (not code comment docs):

  • Index/main page
    • Introduction (#45)
    • Installation
  • Custom loaders (#49)
  • Model manipulation (#69)

Can pysynphot be useful as a dependency?

Some of the spectrum manipulation "wish list" items I saw on the sprint kick-off meeting are things that pysynphot can already do. For example, flux unit conversions, arithmetic, (some) statistics, etc. Instead of starting from scratch, we should look into whether pyfocal can somehow benefit from pysynphot.

http://ssb.stsci.edu/pysynphot/docs/

Handling model layers

Currently, there is no connection to the original layer once a model layer has been created. How do we allow the user to update the values of the model?

  1. We could have the model box only allow the creation of model layers when a data layer is selected, and only allow updating values when a model layer is selected.
  2. Should be use a tree widget instead of a list widget, then, and have the model layer be a child of the data layer?

Dev installation

I'd like the developers to try and to install and run Pyfocal locally. Currently, it is built to support both PyQt4 and PyQt5, but now that Qt4 is no longer being developed or supported, I'd prefer that we use PyQt5 as the recommended build.

As it is now, I've updated the installation instructions to target PyQt5, and I'd like each of you to try and get Pyfocal up and running.

The instructions are here.

Please use this issue for any problems/comments/concerns.

@pllim @ibusko

Installation instructions

I believe the cd pyfocal line should come before the git checkout line in the steps for installing from source code

$ git clone https://github.com/nmearl/pyfocal.git
$ git checkout tags/v0.1rc2
$ cd pyfocal
$ pip install -r requirements.txt

Implement context menus

List/TreeWidgets require contextual menus for e.g. removing, changing line colors, etc.

  • Data list widget
  • Layer list widget
  • Model tree widget

Command line arguments

Extend the pyfocal console script to allow command line arguments:

  • arg: passing fits file from command line
  • kwarg: getting pyfocal version

etc.

pyfocal won't read some test files

Was anybody able to read the test fies in /astro/3/jwst_da_sprint_testdata/SpecView/gderosa/ ?

I get an error from line 200 in astropy/utils/data.py , in which the constructor for an io.FileIO object is called. With these files, the constructor crashes and the resulting file object is None, so the main code crashes as well.

Rename widgets

Currently, the widgets are very non-descript as they are the default names that Qt Creator assigns them. This should be changed for legibility.

Single tap and (sometimes) hover events cause focus change

To reproduce:

  • Have two sub windows open
  • Single tap over plot area of any sub window
  • Sometimes, simply moving focus to a widget outside the MDI area, then hovering over a sub window inside will cause the focus to move to that sub window.

Re-implement third axis

Copy over the code for the top axis on the plots with a dialog option for velocity/redshift/index labels.

Model list clears unexpectedly

I can recreate it with the following workflow:

  1. Open a spectrum in Pyfocal. The generic test FITS spectrum will do.
  2. Select a retangular ROI, say, around the Gaussian feature.
  3. Add a Gaussian model.
  4. Create a layer slice.
  5. Switch to slice view.
  6. Switch back to main layer. Now the model is no longer listed.

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.