Coder Social home page Coder Social logo

dic-case-studies / casa6 Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 152.09 MB

Fork of NRAO's CASA

Home Page: https://open-bitbucket.nrao.edu/projects/CASA/repos/casa6/browse

CMake 0.39% Shell 0.40% Perl 0.13% C++ 50.91% Python 18.46% C 0.14% HTML 0.42% CSS 0.01% JavaScript 0.04% TeX 2.59% Tcl 0.02% Batchfile 0.01% PostScript 1.03% Roff 0.01% sed 0.27% Raku 0.01% Awk 0.01% Fortran 24.97% XSLT 0.14% SWIG 0.06%

casa6's Introduction

CASA 6

CASA 6 marks a major new chapter in CASA's development. With CASA 6, tools and tasks will be available as Python wheels from a PyPI repository. These wheels can then be installed in any version of Python 3.6. In time CASA will provide wheels for other versions of Python.

Organization

CASA 6 divides CASA's functionality into two Python packages:

  • casatools -- the C++ tools with a minimal Python layer
  • casatasks -- a pure Python layer which provides a higher level of abstraction

casatasks is very similar to the CASA 5 tasks (but see discussion of inp/go below). However, with casatools there was some redundancy in CASA 5. This redundancy has been removed. For example, the image analysis tool has always been called image but it was exposed in CASA 5 as ia (and public instance of the image tool) and iatool a synonym for image. The instance and synonym are no longer available for CASA 6 tools, but it is easy to import the CASA 6 tool in the CASA 5 style:

>>> from casatools import image as iatool
>>> ia = iatool( )

These changes are sumarized in this document.

Installation

These packages can be installed in Python from NRAO's PyPI repository. The recommended way to do this is using a virtual environment:

-bash-4.2$ python3 -m venv casa6
-bash-4.2$ source casa6/bin/activate
-bash-4.2$ pip install --extra-index-url https://casa-pip.nrao.edu:443/repository/pypi-group/simple casatasks
-bash-4.2$ #sanity check
           #              -bash-4.2$ python
           #              >>> import casatasks as ct
           #              >>> help(ct)
           #              >>> exit()
           #              -bash-4.2$
-bash-4.2$ deactivate

However, users are free to install CASA's wheels as they like.

Inp/Go and Subparameters

In general, casatasks is identical to the CASA 5 version of the tasks. The primary difference is that the inp, go, default, and subparameters are no longer part of the tasks. This functionality has been moved up into another module called casashell. This module provides an environment that is very similar to the standard CASA prompt. In this layer parameters can be specified by setting global variables, checked with inp, and the task can be invoked with go. This change was made because this functionality depends upon IPython and the fetching, setting, and clearing of global variables by access to the task call stack. The former may not be available and the latter is problematic for packages loaded into the user's Python installation. For users who want this environment, it is accessible with the casashell module either from the bash command line if the casashell module has been installed:

-bash-4.2$ python3 -m casashell

or from Python 3:

-bash-4.2$ python3
Python 3.6.7 (default, Aug 16 2019, 18:25:33)
[GCC 5.3.1 20160406 (Red Hat 5.3.1-6)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from casashell import start_casa
>>> start_casa([])
IPython 7.8.0 -- An enhanced Interactive Python.

Using matplotlib backend: TkAgg
in startup
CASA 5.9.9-922 -- Common Astronomy Software Applications [2019.214]

CASA <1>:

CASA's GUIs

The primary GUIs casaviewer and casaplotms are available as separate modules. These allow the GUIs to be loaded and used.

Some of the GUI tools available as part of CASA 5 are only available in the packaged tar-file based disribution of CASA 6. The GUIs that are currently only available in the monolithic vesion of CASA 6 currently includes:

  1. casabrowser
  2. casafeather
  3. casalogger
  4. casaplotserver

Debugging with GDB and Valgrind

To build casatools with debugging symbols, run casatools/setup.py with either the debug or relwithdebinfo flags. For example:

-bash-4.2$ ./setup.py --debug bdist_wheel
-bash-4.2$ ./setup.py --relwithdebinfo bdist_wheel

To run casa with gdb, start casa (interactively or from a script) and attach to it's process id:

-bash-4.2$ ps -e | grep python3
25915 pts/2    00:00:01 python3
-bash-4.2$ gdb -p 25915

Then set breakpoints like normal, albeit with some name wrangling:

(gdb) break casa6core::MeasurementSet::MeasurementSet()
Breakpoint 1 at 0x7ff0d026b010: file casacore/ms/MeasurementSets/MeasurementSet.cc, line 68.
(gdb) continue

To run casa with valgrind + gdb, start with valgrind with PYTHONMALLOC=malloc, emulate what the bin/casa perl script does, and attach gdb with the target command. For example, to start casa and look for memory mismanagement:

-bash-4.2$ LITHDIR="casalith/build-casalith/work/linux/output/casa-bbean-6.2.0-9"
-bash-4.2$ EXTPATH="${LITHDIR}/lib/py/bin:${LITHDIR}/lib/casa/bin:${PATH}"
-bash-4.2$ PATH="$EXTPATH" PYTHONMALLOC=malloc valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes \
> --log-file=valgrind.log "${LITHDIR}/lib/py/bin/python3" -m casashell --nogui --log2term -c <yourpythonfile>.py

Now in another terminal, attach gdb:

-bash-4.2$ PATH="$EXTPATH" gdb "${LITHDIR}/lib/py/bin/python3"
(gdb) target remote | /usr/bin/vgdb
(gdb) break casa6core::MeasurementSet::MeasurementSet()
Breakpoint 1 at 0x7ff0d026b010: file casacore/ms/MeasurementSets/MeasurementSet.cc, line 68.
(gdb) continue

casa6's People

Contributors

dmehring avatar vsuorant avatar tnakazato avatar schiebel avatar fedempouzols avatar pford avatar kgolap avatar smcastro avatar taktsutsumi avatar cquike avatar naojkanas avatar watarukawasakinaoj avatar snishie avatar nicolaiarocci avatar gmoellen avatar sanbw avatar bgarwood avatar urvashirau avatar dpetry avatar nschweig-nrao avatar katz-s avatar yohei99 avatar dessmalljive avatar jimnrao avatar awells-nrao avatar funkyfuture avatar renaudmiel avatar caillat avatar mpokorny avatar kettenis avatar

Stargazers

Sebastian Oeste avatar

Watchers

Nimalan avatar

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.