Single Dish Radio Astronomy Software Tools¶
For an overview of SDRAST and the current status please visit https://sdrast.github.io/.
Please note that the modules configuration, messagebus, pyro, trifeni and tunneling are not yet working under Python 3.
support Package¶
Package to provide support for various objects and modules
This module contains functions that don’t have an obvious home in a submodule.
Functions¶
|
Create an array. |
|
Verify that the user has the necessary permissions. |
|
|
|
Test whether a path exists. |
|
Returns the user running this session |
|
Super-mkdir; create a leaf directory and all intermediate ones. |
|
|
|
Return the index of the element of the array with the nearest value |
|
Delay execution for a given number of seconds. |
Wait until the second changes |
|
|
Return the current time in seconds since the Epoch. |
Classes¶
|
A base class enhanced with methods for reporting self. |
A subclass of MCobject enhanced with properties. |
Class Inheritance Diagram¶
support.arguments Module¶
Support for Python argparse (or optparse) module
How to use this:
p = initiate_option_parser(description,examples)
p.usage = usage
# Add other options here
opts, args = p.parse_args(sys.argv[1:])
# This cannot be delegated to another module or class
mylogger = init_logging(logging.getLogger(),
loglevel = get_loglevel(opts.file_loglevel),
consolevel = get_loglevel(opts.stderr_loglevel),
logname = opts.logpath+__name__+".log")
loggers = set_module_loggers(eval(opts.modloglevels))
In either case, the parser object will be a argparse.ArgumentParser object
Converting from optparse to argparse¶
The package ‘optparse’ has been made obsolescent. In converting from ‘optparse’ to ‘argparse’, replace ‘add_option’ with ‘add_argument’ and change the ‘type’ value from a string to a Python variable type, e.g. float
Functions¶
|
Initiate an option parser with default logging options |
|
Grab arguments relevant to the Pyro nameserver that have APC and Spectrometer servers registered. |
Classes¶
Interprets the argument provided as the specied type of iterable |
|
|
Subclass of OptionParser which does not mess up examples formatting |
|
front end for ArgumentParser for older programs from ‘optparse’ days |
|
Formatter which does not remove newline codes |
Class Inheritance Diagram¶
support.control_flow Package¶
Classes¶
Mixin class for controlling when and until when functions are called. |
Class Inheritance Diagram¶
support.coroutine Module¶
Classes¶
This provides a subclass with a |
Class Inheritance Diagram¶
support.dicts Module¶
support for dict objects
Functions¶
|
Converts nested dicts with numeric or str keys to flat dict with tuple keys. |
|
Extract values from a multi-depth dictionary |
|
Creates a key in an existing dictionary if it does not exist |
|
Converts tuple keys to str keys |
support.excel Module¶
Support for openpyxl
Use of module functions is not elegant. I should try to subclass openpyxl.workbook.Workbook
This works for open-pyxl 1.x. Starting with 2.0, the row and column indexing starts with 1 instead of 0.
Functions¶
|
Add one empty column to a sheet |
|
Add a list of empty columns to a sheet |
|
Create a dictionary of column number indexed by column name |
|
Return the column label given its numerical index |
|
Return column number, with left column being 0. |
|
Find or create a column |
|
from http://stackoverflow.com/questions/23562366/ how-do-i-get-value-present-in-a-merged-cell does not work in this version of openpyxl |
|
Get the data as a list from a column identified by its name. |
|
Returns column letter of the first column with that name |
|
Convert a column index into a column letter (3 -> ‘C’) |
|
Dictionary of column names indexed by column letter |
|
Get the first row which has the specified value in the designated column |
|
Get the row numbers for rows with a given value in a column |
|
Get a list of rows (each a list of cells) with a given value in a column |
|
Move all the rows above ‘prior_row’ down one and ‘prior_row’+1 emptied. |
|
Open the given filename and return the workbook |
Set the width of the columns to fit the data in the top two rows |
Classes¶
|
incomplete |
Class Inheritance Diagram¶
support.git Package¶
support.git - creates superdep.txt and subdep.txt files
subdep.txt lists repositories below the current repository in the filesystem.
superdep.txt lists repositories above the current one to the top of tree.
TO DO:: * Handle the case of multiple remotes. Use only ‘jpl’ and ‘jplra’. * Take care of the intermediate repositories * Look at the imports in __init__.py to see what other repos are needed
Functions¶
Finds new files in the current directory as does ‘git add’ for them. |
|
|
Convenience so this test hast to be done only once |
|
Compares status of local and remote repo |
|
Compares status of all local and remote repos |
|
Find the repo trunk(s) in the specified directory |
Finds all the sub-directories on the system which are git sandboxes. |
|
|
Get the level value from text |
|
Create a logger that displays to the console and writes a log file. |
Clones the repos needed by this repo. |
|
|
Add submodule (separate repo in this directory) to subdep.txt |
|
Create list of repos in the directory tree above this repo |
|
Does ‘git status’ for all the sandboxes. |
support.git.pull_submodule_branches Module¶
Functions¶
Even after calling git submodule update –init –recursive submodule will be on a detached branch. |
support.graphics Package¶
Various routines to support matplotlib graphics
Functions¶
|
Define the X-axis label format |
|
Optional over-ride for matplotlib tick placement. |
|
Return a new array of given shape and type, without initializing entries. |
|
Compute the one-dimensional discrete Fourier Transform. |
|
Shift the zero-frequency component to the center of the spectrum. |
from https://stackoverflow.com/questions/3597965/ getting-monitor-resolution-in-python-on-ubuntu |
|
|
Converts a sequence of complex samples into a spectrogram |
|
Label an axis with different units from the data |
|
Make a second axes overlay ax (or the current axes if ax is None) sharing the xaxis. |
support.graphics.colormap Module¶
These functions, when given a magnitude mag between cmin and cmax, return a colour tuple (red, green, blue). Light blue is cold (low magnitude) and yellow is hot (high magnitude). From http://code.activestate.com/recipes/52273/
Functions¶
|
Create a color bar using the RGB mapping of this module |
|
Return a tuple of floats between 0 and 1 for the red, green and blue amplitudes. |
|
Return a tuple of strings to be used in HTML documents. |
|
|
|
Return a tuple of integers to be used in AWT/Java plots. |
|
Return a tuple of strings to be used in Tk plots. |
support.graphics.northpolar Module¶
Classes¶
|
A mutable 2D affine transformation. |
|
A mutable bounding box. |
|
A special class that does one thing, the identity transform, in a fast way. |
|
A variant of PolarAxes where theta starts pointing north and goes clockwise. |
|
A polar graph projection, where the input dimensions are theta, r. |
Class Inheritance Diagram¶
support.hdf5_util Package¶
Functions¶
|
List out the attributes of some HDF5 file object. |
|
Get a dictionary that reports the structure of some HDF5 file. |
|
Dump the contents of a data dictionary into some file object or group. |
Class Inheritance Diagram¶
support.HTML Module¶
Classes¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
superclass for HTML tag classes |
|
Class Inheritance Diagram¶
support.lists Module¶
Methods to support lists
Functions¶
|
Reports whether ‘value’ is in ‘List’ |
|
Make a list of nested lists a simple list |
|
Print a dictionary, one line for each item, with the keys sorted |
|
Remove item from list without complaining if absent |
|
Rotate one or more lists subject to constraints on the first list |
|
Removes duplicate elements from a list |
support.local_dirs Module¶
paths to local packages and data
support.logs Module¶
module with enhancements to the Python logging
Functions¶
|
setup up some logging.getLogger instance with console logging and file logging handlers (StreamHandler and FileHandler handlers, respectively.) |
|
Set the level of a logger |
|
Get the level value from text |
|
Create a logger that displays to the console and writes a log file. |
|
Setup an instance of TLSSMTPHandler |
|
remove any handlers associated with a logger. |
Classes¶
|
Custom handler for email logging using TLS encryption. |
Class Inheritance Diagram¶
support.markdown_util Package¶
Classes¶
|
Create a formatted markdown table from some header and data. |
Class Inheritance Diagram¶
support.markdown_util.table Module¶
Classes¶
|
Create a formatted markdown table from some header and data. |
Class Inheritance Diagram¶
support.network Module¶
Functions¶
|
Get information about and status of local network hosts with port open |
|
Returns a long int for an IPv4 or IPv6 address. |
|
Returns a long int for a MAC address |
|
|
|
Returns the networks key whose list contains netIP |
|
Returns the IP address of the local network |
|
Convenient alternate for a command without stdin. |
support.options Module¶
Support for Python argparse (or optparse) module
How to use this:
p = initiate_option_parser(description,examples)
p.usage = usage
# Add other options here
opts, args = p.parse_args(sys.argv[1:])
# This cannot be delegated to another module or class
mylogger = init_logging(logging.getLogger(),
loglevel = get_loglevel(opts.file_loglevel),
consolevel = get_loglevel(opts.stderr_loglevel),
logname = opts.logpath+__name__+".log")
loggers = set_module_loggers(eval(opts.modloglevels))
In either case, the parser object will be a argparse.ArgumentParser object
Converting from optparse to argparse¶
The package ‘optparse’ has been made obsolescent. In converting from ‘optparse’ to ‘argparse’, replace ‘add_option’ with ‘add_argument’ and change the ‘type’ value from a string to a Python variable type, e.g. float
Functions¶
|
Initiate an option parser with default logging options |
|
Grab arguments relevant to the Pyro nameserver that have APC and Spectrometer servers registered. |
Classes¶
Interprets the argument provided as the specied type of iterable |
|
|
Subclass of OptionParser which does not mess up examples formatting |
|
front end for ArgumentParser for older programs from ‘optparse’ days |
|
Formatter which does not remove newline codes |
Class Inheritance Diagram¶
support.process Module¶
process - support for executing shell commands
Functions¶
|
Convenient alternate for a command without stdin. |
|
|
|
Search a local command response. |
Classes¶
|
Class representing a basic process, with name and pid. |
|
Execute a child program in a new process. |
Class Inheritance Diagram¶
support.rtc Package¶
Module for using the computer’s Real Time Clock device
Provides class RTC
The rtc time structure is:
struct rtc_time {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday; /\* unused \*/
int tm_yday; /\* unused \*/
int tm_isdst; /\* unused \*/};
Compiled C program ‘rtc_constants’ returns the addresses of the RTC registers for the RTC.
See ‘man rtc’ for documentation
From http://www.larsen-b.com/Article/221.html
Classes¶
|
Class for the Real Time Clock device |
|
Class Inheritance Diagram¶
support.text Module¶
text - functions for handling text
Functions¶
|
Returns the final component of a pathname |
|
Remove or replace math mode symbols like underscore |
|
Calculates the Levenshtein distance between a and b. |
|
Append an updated version number to a file |
|
Return a list of paths matching a pathname pattern. |
|
Return true if the pathname refers to an existing directory. |
|
Test whether a path is a regular file |
|
Find the length of the longest string in a list |
|
turn a text string of words into a title by capitalizing each word |
|
same as distance() but ignores case |
|
reduce multiple whitespaces to one |
|
remove HTML tags from text |
|
Select files by glob pattern |
|
Send an e-mail message |
|
Split the extension from a pathname. |
|
Like ‘raw_input’ except that a default value can be specified. |
support.threading_util Package¶
Functions¶
|
A decorator for running functions repeatedly inside a PausableThread. |
Classes¶
|
A pausable stoppable thread. |
|
A context manager for pausing threads. |
|
A barebones publisher thread. |
Class Inheritance Diagram¶
support.threading_util.pausable_thread Module¶
Functions¶
|
A decorator for running functions repeatedly inside a PausableThread. |
Classes¶
|
A context manager for pausing threads. |
|
A pausable stoppable thread. |
|
A thread that runs the same callback over an over again, with some predetermined wait time. |
Class Inheritance Diagram¶
support.threading_util.publisher_thread Module¶
Classes¶
|
A pausable stoppable thread. |
|
A barebones publisher thread. |
Class Inheritance Diagram¶
support.weather Module¶
Functions¶
|
Format response object from _make_geocoding_api_request. |
|
Get the weather at a certain latitude and longitude |