returns a list with the emails of all users with directories in /lustre/* or /lustre/allegro/home/*
Parameters: |
---|
checks the directory size with the shell command ‘du’
Parameters: | |
---|---|
Returns: | direcotry size (human readable) |
returns the email of a user. It distinguishes between STRW members and Allegro visitors.
Parameters: | user (str) – username |
---|---|
Returns: | |
Return type: | str |
returns the first name of the user (if the user is a STRW member, otherwise simply an ‘Allegro user’ is returned
returns the HD usage of the disk that hosts directory
Parameters: | directory (str) – directory to check HD usage on |
---|---|
Returns: | tuple with total, free, used memory |
converts a permission in ‘rwxrwxrwx’ format to a python stat-flag.
Parameters: | rwx (str) – permission string |
---|---|
Returns: | stat-flag |
The class “project” manages all kinds of project things. You can create a new project, you can link/unlink users, you can attach data. For this class, some directories are defined:
Database:
User directory:
Data directory:
checks if an ID is a valid ALMA ID of the form YYYY.C.IIIII.X with
if you are in an arbitrary directory, run this command to get the allegro ID of the project you are currently in
Activates the next free Allegro visitor account. This method calls the terminal command
$ allegro-add-user
which is a script that provides the necessary super-user permissions to activate the new account.
Parameters: | mail (bool) – Send out an email to the user |
---|
Adds a face-to-face visit to the database
Parameters: |
|
---|
Adds an email to the Allegro newsletter list
Params str email: | |
---|---|
email (can also be a list) |
changes the state of the currently buffered project. Possible states are:
Parameters: | state (int) – new state |
---|
checks the last date a file in this project has been accessed
Returns: | datetime object with last access |
---|
check message with OK and Failed
Parameters: |
---|
Creates a new project directory with all subdirectories and links.
Parameters: |
---|
The script will then
backs up data in the currently loaded project
Parameters: | user (str) – is username is given, only the directory projectID/analysis/username is backed up. |
---|
This function performs the following steps:
find all files that match the rsync filter self.rsync
project ID and the current date, through rsync.
Deactivates the currently loaded visitor account.
Parameters: | mail (bool) – Send out an email to the user |
---|
prints a headline with ‘=’* and the title in it
Parameters: | title (str) – title |
---|
links data from the public data directory into the archive directory of a project
Parameters: |
---|
Warning
When unlinking, the listOfPublicDatasets is reduced to the datasets that are linked to the project. Therefore, the indices are different from the self.listOfPublicDatasets
Adds a user to the currently loaded project.
Parameters: |
---|
With this information, the script then does the following steps:
lists the face-to-face visits to Allegro
Parameters: |
|
---|
list the current list of newsletter subscribers
lists all projects and a short summary. Optionally, when giving an ID, a full summary of that project is displayed.
Parameters: |
---|
lists the QA2 work that is done at Allegro
Parameters: |
|
---|
loads a face-to-face visit
Parameters: |
|
---|
loads a public dataset
Parameters: |
|
---|
loads a public dataset
Parameters: |
|
---|
load a qa2 project
Parameters: |
|
---|
loads a user
Parameters: |
|
---|
loads a visitor
Parameters: |
|
---|
modifies the ticket IDs for the helpdesk and the JIRA tickets of the currently loaded project
Parameters: | ticket (str or int) – 3-element list with ticket IDs for helpdesk, SB and QA2 tickets |
---|
modifies the expiration date of the currently loaded visitor account. This calls the sudo script “allegro-reset-expiration num date”, which has the command line arguments “num”, which is the number of the allegro account (e.g., “1” for “allegro1”) and “date”, which is the new expiration date.
Parameters: | date (str) – new expiration date (must be of form YYYY-MM-DD) |
---|
prints a message to the console. Default printing option
queries for a valid ID in string format. The input from the query can either be an integer or a string. The return value will always be the list element
Parameters: |
---|
Example:
>>> table = ['val1', 'val2', 'val3']
>>> parameter = query_for_list_element(table, title="parameter")
ID parameter
==========================
[ 0] val1
[ 1] val2
[ 2] val3
ID or parameter: 2
>>> parameter
'val3'
>>> parameter = query_for_list_element(table, title="parameter")
ID parameter
==========================
[ 0] val1
[ 1] val2
[ 2] val3
ID or parameter: val2
>>> parameter
'val2'
>>> parameter = query_for_list_element(table, value=0, title="parameter")
>>> parameter
'val2'
>>> parameter = query_for_list_element(table, value=-1, title="parameter")
>>> parameter
'val2'
random alphanumeric string generator
Parameters: | length (int) – string length |
---|
removes the currently loaded newsletter subscriber from the list
Remove a project.
Parameters: |
---|
The following steps are performed:
returns a dictionary with the symlink pairs in a certain directory
Parameters: | directory (str) – directory to search for symlinks |
---|
Removes a user from the currently loaded project
Parameters: |
|
---|
The script performs the following steps:
Writes out the current listOfNewsletter to the newsletter subscription database
amp/phase vs. time for all calibrators and amp/phase vs. channel for bandpass for all spectral windows
Parameters: |
---|
converts channel width to velocities
Parameters: | vis (str) – measurement set |
---|
writes out the pointings into a ds9 region file
Parameters: |
---|
This function inverts flags so that they can be used as input for fitspw in uvcontsub.
Parameters: | |
---|---|
Returns: | two strings, one for flag and fitspw |
Examples:
You work on a measurement set with 4 spectral windows and 128 channels each. You want to flag channels 40 to 80 in spw 2? You can specify the flags in two ways:
>>> flag = '2:40~80'
>>> flag = ['','','40~80','']
These are absolutely equivalent.
>>> spw, fitspw = flag_to_fitspw('myvis.ms', ['','','40~80',''])
>>> spw
'2:40~80'
>>> fitspw
'0,1,2:0~39;80~119,3'
If you use the rep keyword, it repeats this sequence.
>>> spw, fitspw = flag_to_fitspw('myvis.ms', ['','','40~80',''], rep=2)
>>> spw
'2:40~80,5:40~80'
This is particularly useful if you have two or more concatenated datasets, where the sequence of spectral windows is repeated.
Plots the flux densities that were derived in the EB
Parameters: |
|
---|
returns a key for observing mode and the colour to plot (helper function for listobs)
Parameters: | mode (str) – observing mode |
---|---|
Returns: | short key for observing mode and color in hex-format |
Return type: | str |
finishes the html file and closes the instance f
Parameters: | f (file) – html-file object |
---|
creates the header of an html file. It returns an instance of the open file that has to be passed on to other procedures, and eventually be closed with html_close().
Parameters: | |
---|---|
Returns: | instance that contains the open file |
Return type: | file |
closes the table
Parameters: | f (file) – html-file object |
---|
writes the table tag
Parameters: | f (file) – html-file object |
---|
writes table table row
Parameters: |
---|
checks the rms in a box as a function of channels in the image to deliver. Currently, this function assumes that the axis are
- 0 - Direction 1
- 1 - Direction 2
- 2 - Polarisation
- 3 - Spectral
Parameters: |
|
---|
creates a html-file that contains an extensive summary of the measurement set.
This page will contain:
elevation vs. amplitude)
Fields: id, name, position, intents
frequency, bandwidth, intent (including a plot of the frequency coverage of the science spectral windows)
the antenna positions)
PWV: plot of the PWV vs. time
Distances: table of angular distances to each source
Parameters: |
---|
This function plots:
over spectral windows
fields and spectral windows
Parameters: |
|
---|
sends a mail through the terminal command “mail”
Parameters: |
|
---|
returns pre-defined messages
Parameters: |
|
---|
Useful functions to convert between times in various reference frames.
converts Modified Julian Date (MJD) to a unix timestamp.
Parameters: | |
---|---|
Returns: | Unix timestamp (in seconds) |
Generally, the CASA output is MJD in seconds.
>>> from datetime import datetime
>>> t_unix = mjd_to_unix(4.9144e9, seconds=True)
>>> t_unix
1407683199.9999998
>>> datetime.fromtimestamp(t_unix)
datetime.datetime(2014, 8, 10, 17, 6, 40)
converts a unix time to formatted string (assumes UTC)
Parameters: |
|
---|---|
Returns: | string represenation of the time |
>>> from datetime import datetime
>>> t_unix = mjd_to_unix(4.9144e9, seconds=True)
>>> t_unix
1407683199.9999998
>>> unix_to_string(t_unix)
'2014/08/10/15:06:40'
>>> unix_to_string(t_unix, format='%D')
'08/10/14'
allegroUtils.wvr
A set of routines to help analyze WVR solutions.
June 2016: v0.9 - LM more custom code for WVR scaling minimisation and searches to select data
JAN: v0.8 - LM more integration and adjustments
JUNE-SEP: v0.7 - LM added much more functionality for phase unwrapping options
14Jan15 : v0.6 - LM integrated functions generated for the project
09sep14 : v0.5 - TvK integrated functionality written during EOC weeks and update of role within the allegroUtils package
14may14 : 0.4 - TvK - Adapted the sqlite interface to work with information on the source
09may14 : 0.3 - MS - Included the wvr-tools into the allegroUtils-package and put it under version control. Some functions (antennaENU, stokes, getband) have been moved to “casacore” bundle, another one (rms) to the “core” bundle.
25mar14 : 0.2 - TvK - Started from v0.1 and removed functions. Added Comments, removed old functions.
01feb14 : 0.1 - MS - Initial build. The initial bundle of scripts by Sarah Graves (U Cambridge) contained the following functions:
These functions were updated/modified and their functionality enhanced. The wrappers to extract the information for our datasets were put in place, which are
Additional functions were included
allegroUtils.wvr.wvr contains the following functions:
allegroUtils.wvr.allanvariance contains the following functions
allegroUtils.wvr.wvrtools contains the following functions
allegroUtils.wvr.mysql contains the following functions
allegroUtils.wvr.plottools contains the following functions
allegroUtils.wvr.phaseRef contains the following functions TODO
Calc mean over ~10 sec return average
Read phase array and calc rolling mean This is over elements not real time actually but integration time is 0.96s
Parameters: | phase (float array) – any unwrapped input phase |
---|---|
Returns: | Mean for overlapping 10 sec cycles |
Return type: | float |
Calc STD over 10 sec return average
Parameters: | phase (float array) – any unwrapped input phase |
---|---|
Returns: | Stanard deviation for independent 10 sec cycles |
Return type: | float |
Read a phase array which must be unwrapped and have been checked for incorrect jumps (although this should not significantly affect these statistics if jumps are minimal) and calculated the STD in overlapping 10 sec times only for this EOC data with 0.96 integration times. Note this is STANDARD DEVIATION HERE - takes out the mean value. RMS with mean or fit removed SHOULD be the same value for zero centred phase.
Calc STD over time and return the average
Parameters: |
|
---|---|
Returns: | Stanard deviation for independent ‘over’ cycles |
Return type: | float |
Read a phase array which must be unwrapped and have been checked for incorrect jumps (although this should not significantly affect the statistic is jumps are minimal) and calculated the STD in overlapping times (user input) only for this EOC data with 0.96 integration times. Note this is STANDARD DEVIATION HERE - takes out the mean value. RMS with mean or fit removed SHOULD be the same value for zero centred phase.
This function calculates the angular seperation of sources on the sky using the Vincenty formula, one can enter either RA and dec as alp and del, or the AZ and ALT(Elev) as degrees values.
Parameters: | |
---|---|
Returns: | the angular seperation of the sources in degrees |
Return type: | float |
Finds the scans by intent
Parameters: | |
---|---|
Returns: | string with scans |
Return type: | str |
Imports the ASDM into CASA. This function es, which scans to include in the ms from the asdm and then import only those scans. Finally, select a single correlation to import.
Parameters: | |
---|---|
Typew scans_use: | |
string |
|
Returns: | True if import succeeded |
Return type: | boolean |
Reads in two phase (or any match array) data sets and undertakes the cross correlation - this is own code but should be same as the np.correlate command - but doesnt use zero padding and also normalises to 1 max
Parameters: |
|
---|---|
Returns: | the cross correlation value and timescale |
Return type: | float array (2D) |
this reads in either a single phase array or more complex data structure such as the raw phase we read from EOC data, i.e. both pols
Parameters: |
|
---|---|
Returns: | the phases in same format as the input but with outliers as nans - i.e wont plot or be used in unwraps later |
Return type: | float array |
function to read in 3 antennas, extract the phases and calculate the closure phase for the triangle of antennas. Must be given in order, ie 0 1 2 not 2 0 1
Parameters: | |
---|---|
Returns: | array of closure phases |
Return type: | float array |
Find which is the second last spw. This one is pretty much guaranteed to have science data in it. in getSpwIDBaseBand0() there may be some Band6 pointing spws that are getting in the way
Parameters: | vis (string) – measurement set |
---|---|
Returns: | ID of the last channel-averaged spectral window |
Return type: | int |
Find which is the last averaged SPW which is used for scaling
Parameters: | vis (string) – measurement set |
---|---|
Returns: | ID of the last channel-averaged spectral window |
Return type: | int |
Read and ms file and select the phases from one pol and the averaged channel to use in analysis - optionally can flag to nan where ms flags are present
Parameters: |
|
---|---|
Returns: | the phases of a baseline or antenna |
Return type: | float array |
Section of 2-pt calculation to get the polarization averaged phases
Parameters: | |
---|---|
Returns: | the phases of baseline or ant dependent on input query |
Return type: | float array |
Read meta data and return the polarization strings
Parameters: | meta (dictionary) – measurement set |
---|---|
Returns: | list of boolean values for mask |
Return type: | bool list |
Read an ms file and return to zero starting time in seconds - note these are the recored times so there are gaps due to sub scans etc
Parameters: |
|
---|---|
Returns: | the time stamps for the observations |
Return type: | float array |
Read an ms file and return to zero starting time in seconds - note these are the recored times so there are gaps due to sub scans etc
Parameters: | |
---|---|
Returns time: | the time for the observations |
Return type: | float array |
calculates the azimuth of a baseline w.r.t. north.
Parameters: |
|
---|---|
Returns: | list with angles |
Returns the rms of a data array after subtracting a general trend, which is modelled by a polynomial
Parameters: | |
---|---|
Returns: | dictionary with rms for original and corrected phase rms |
Return type: | dict |
Do a linear fit on the phase and then flatten, specifically for only testing the 2-pt variance calcs before and after to see what time scale effected - uses scipy linearregression
Parameters: |
|
---|---|
Returns: | corrected phase offset to zero start |
Return type: | float array |
to read an ms file and create and output unity file
Parameters: |
---|
generate various noise features follwoing P(f)=1/f^beta typical values beta = 0 - Gaussian white noise (NOT equal to uniform white) beta = 1 - pink noise beta = 2 - brownian (red) noise
resulting values are between 0 and 1
Parameters: | |
---|---|
Returns: | two 1D arrays with the phases and times |
Return type: | float,float |
this reads in either a single phase array or more complex data structure such as the raw phase we read from EOC data, i.e. both pols
Parameters: |
|
---|---|
Returns: | the phases in same format as the input but with outliers as nans - i.e wont plot or be used in unwraps later |
Return type: | float array |
Unwraps the phases through averaging
Parameters: |
|
---|---|
Returns: | unwrapped phase-array |
Return type: | float array |
If no time array is given, the phase is simply unwrapped by identifying phase jumps by more than 180deg. That can be quite tricky for noisy data.
For this, the averaging algorithm is introducing. When giving a time-array plus a convolution-kernel width, the time-phase-array is converted into polar coordinates r-phi. These coordinates are averaged to find the general trend, and to see the points where the phase goes beyond [-180, 180], which have to be unwrapped.
Unwraps the phases
Parameters: |
|
---|---|
Returns: | unwrapped phase-array |
Return type: | float array |
If no time array is given, the phase is simply unwrapped by identifying phase jumps by more than 180deg. That can be quite tricky for noisy data - historic but retained - not used.
Modified version where 1) factor can be used to specify wraps (multiples of pi) 2) nans are dealt with correctly
Note is slower, 65 ms vs 200 us
random walk generator, numbers between 0 and 1 :param size: size of array returned :type size: int :param step: Step size of random walk :type step: float
this just returns the line with echo test that my version actually is commanded so I can make edits here
To read in the rest frequency and the allan variance values (or any type of phase) and to convert these into a standard path length in microns. Options for radians or degrees input default is radians
Includes a crude check to see if frequency is in GHz or not
Parameters: | |
---|---|
Returns: | convesion to microns the path length from phase |
Return type: | float array |
Check the phase for incorrect wraps
Parameters: |
|
---|---|
Returns: | phases after check - corrected |
Return type: | float array |
If no limit is set the default of 90 degrees is used to find possible jumps, i.e. incorrect wraps are found if the phase is 180 deg (pi) - lim = 90 deg. Given the phase should have been unwrapped there should not be large differences between the consecutive phase points. Time checks are also performed as phase differences over a scan gap can mean incorrect wraps added back if large lim values are used, i.e. to detect jumps ~ 120 deg in size
The limit sets the sensitivity to detect the jump. Larger lim value means more jumps found, i.e lots of consecutive phases vary by 180 - lim, which is small. To check then we make sure the jump is not over a time gap then check that the rolling means over/2 before and after the are different by the 2 x the nominal standard deviation x std_val (input). This acts as the robustness to ensure the jump found is real or not. To be robust to the places where phases are noisy in a row the rolling means are shifted when a jump is correctly found, such that a subsequent jump close in time checks the adjusted means which, would be aligned if only one jump is real and rest were noise (for clustered points).
Note, limitation is the before rms is used if enough elements to do so, otherwise uses the starting phase values
Check the phase for incorrect wraps - deals with nans, removes and concatinates, returns original lenght array and replaces nans after wrap checking
Parameters: |
|
---|---|
Returns: | phases after check - corrected |
Return type: | float array |
If no limit is set the default of 90 degrees is used to find possible jumps, i.e. incorrect wraps are found if the phase is 180 deg (pi) - lim = 90 deg. Given the phase should have been unwrapped there should not be large differences between the consecutive phase points. Time checks are also performed as phase differences over a scan gap can mean incorrect wraps added back if large lim values are used, i.e. to detect jumps ~ 120 deg in size
The limit sets the sensitivity to detect the jump. Larger lim value means more jumps found, i.e lots of consecutive phases vary by 180 - lim, which is small. To check then we make sure the jump is not over a time gap then check that the rolling means over/2 before and after the are different by the 2 x the nominal standard deviation x std_val (input). This acts as the robustness to ensure the jump found is real or not. To be robust to the places where phases are noisy in a row the rolling means are shifted when a jump is correctly found, such that a subsequent jump close in time checks the adjusted means which, would be aligned if only one jump is real and rest were noise (for clustered points).
Note, limitation is the before rms is used if enough elements to do so, otherwise uses the starting phase values
Check the phase for incorrect wraps
Parameters: |
|
---|---|
Returns: | phases after check - corrected |
Return type: | float array |
If no limit is set the default of 90 degrees is used to find possible jumps, i.e. incorrect wraps are found if the phase is 180 deg (pi) - lim = 90 deg. Given the phase should have been unwrapped there should not be large differences between the consecutive phase points. Time checks are also performed as phase differences over a scan gap can mean incorrect wraps added back if large lim values are used, i.e. to detect jumps ~ 120 deg in size
The limit sets the sensitivity to detect the jump. Larger lim value means more jumps found, i.e lots of consecutive phases vary by 180 - lim, which is small. To check then we make sure the jump is not over a time gap then check that the rolling means over/2 before and after the are different by the 2 x the nominal standard deviation x std_val (input). This acts as the robustness to ensure the jump found is real or not. To be robust to the places where phases are noisy in a row the rolling means are shifted when a jump is correctly found, such that a subsequent jump close in time checks the adjusted means which, would be aligned if only one jump is real and rest were noise (for clustered points).
Note, limitation is the before rms is used if enough elemnts to do so, otherwise uses the starting phase values
Check the phase for incorrect wraps
Parameters: |
|
---|---|
Returns: | phases after check - corrected |
Return type: | float array |
If no limit is set the default of 90 degrees is used to find possible jumps, i.e. incorrect wraps are found if the phase is 180 deg (pi) - lim = 90 deg. Given the phase should have been unwrapped there should not be large differences between the consecutive phase points. Time checks are also performed as phase differences over a scan gap can mean incorrect wraps added back if large lim values are used, i.e. to detect jumps ~ 120 deg in size
The limit sets the sensitivity to detect the jump. Larger lim value means more jumps found, i.e lots of consecutive phases vary by 180 - lim, which is small. To check then we make sure the jump is not over a time gap then check that the rolling means over/2 before and after the are different by the 2 x the nominal standard deviation x std_val (input). This acts as the robustness to ensure the jump found is real or not. To be robust to the places where phases are noisy in a row the rolling means are shifted when a jump is correctly found, such that a subsequent jump close in time checks the adjusted means which, would be aligned if only one jump is real and rest were noise (for clustered points).
Note, limitation is the before rms is used if enough elements to do so, otherwise uses the starting phase values. Also has option rapid, this means if you see rapid changes in the phases sometimes over the gaps it will think there is a jump, i.e. more than 1.3 * pi in a 60 sec gap. If you use option rapid, then it compares the same jump but over 30 seconds, only if jump is larger than 1.3 * pi over a 30 sec gap in the 60 second averaged data does it perform a wrap correction
Returns the Allan Deviation of irregularly time-sampled distribution.
This algorithm uses
similar to the time-series algorithm with overlapping. The normalisation factor comes from Allan’s original definition of the Allan variance
This algorithm does not resample an irregularly sampled time-series onto a regular grid, but assumes that all phase measurements are taken in equal timesteps.
To account for time-gaps, use irrAllanVariance().
Note that this function returns the Allan Deviation rather than the Allan Variance. This originates in the Allan Variance function that was originally defined in the analysisUtils, and might change in later releases of the allegroUtils.
Parameters: |
---|
Analyse the data products and generates fits tables with the Allan Deviation for each dataset.
Parameters: |
|
---|---|
Returns: | If no file prefix is given, the routine returns a dictionary with the Allan Deviation |
Return type: | dict |
LTM version of the 2pt deviation calculation
Parameters: |
|
---|---|
Returns: | 2-dim array with timescales and 2 point deviation |
Matches the Hills2 code by MS, but is a bit faster and still deals with gaps. Not as fast as Hills3 but no gap issues or interpolation problems. This gives a specific 2-pt deviation for a selected time interval only. Not a series of 2-pt values.
LTM version of the 2pt deviation calculation
Parameters: |
|
---|---|
Returns: | 2-dim array with a single timescale and 2 point deviation value |
Matches the Hills2 code by MS, but is a bit faster and still deals with gaps. Not as fast as Hills3 but no gap issues or interpolation problems. This gives a specific 2-pt deviation for a selected time interval only. Not a series of 2-pt values.
Calculate the ratio of the baselines Time cuts are : < 20 seconds 20 - 80 seconds 80+ seconds
Generates all the files for the WVR analysis, namely: * measurement set (asdm.ms) * measurement set with no data (asdm.unity.ms) * wvr calibration table (asdm.wvr)
Parameters: |
---|
This code reads the fits files created for a dataset (one source) that has been processed in Allegro routines and compares a range of scaling factors for the WVR solution and makes a plot of the output
Parameters: |
|
---|---|
Returns: | List of the scaling factors and timescales |
Return type: | List Array |
Returns the Two-Point Deviation (sigma) of any irregularly time-sampled distribution.
This algorithm uses
which is similar to the time-series algorithm with overlapping, including a normalisation factor that originates in Allan’s original definition in AllanVariance().
This algorithm resamples an irregularly sampled time-series onto a regular grid with a timestep of .
Note
that this function returns the Two-Point Deviation rather than the Allan Variance. This originates from the Allan Variance function
that was originally defined in the analysisUtils, and might change in later releases of the allegroUtils.
Parameters: |
|
---|---|
Return float: | 2-dim array with timescales and 2-pt Deviation |
Returns the Two-Point Deviation (sigma) of any irregularly time-sampled distribution.
This algorithm uses
which is similar to the time-series algorithm with fixed estimator,
where the data has been averaged over a timebin of width .
This algorithm resamples an irregularly sampled time-series onto a regular grid with a timestep of .
Note
that this function returns the Two-Point Deviation rather than the Allan Variance. This originates from the Allan Variance function
nomenclature that was originally defined in the analysisUtils, and might change in later releases of the allegroUtils.
Parameters: |
|
---|---|
Return float: | 2-dim array with timescales and 2-pt Deviation |
Returns the Two-point Deviation (sigma) of irregularly time-sampled distribution.
This algorithm uses
the frequency-series algorithm with overlapping.
This algorithm is accurate, even if there are time gaps. Owing to the double summation, it’s up to a factor of 10 slower than irrAllanVariance_Hills3().
This algorithm resamples an irregularly sampled time-series onto a regular grid with a timestep of .
Note
that this function returns the Two-Point Deviation rather than the Allan Variance. This originates from the Allan Variance function
nomenclature that was originally defined in the analysisUtils, and might change in later releases of the allegroUtils.
Parameters: |
|
---|---|
Return float: | 2-dim array with timescales and 2-pt Deviation |
Returns the Two-Point Deviation (sigma) of any irregularly time-sampled distribution.
This algorithm uses
the time-series algorithm with overlapping. The time-series is
recursively generated from the phase-series, using and starting with
.
This algorithm is much faster than irrAllanVariance_Hills2(), but you should be aware of the following note:
Note
Owing to the fact that one has to interpolate over time gaps, this algorithm can be error-prone in the presence of non-continuous data, and should be treated with caution.
Note
that this function returns the Two-Point Deviation rather than the Allan Variance. This originates in the Allan Variance function
nomenclature that was originally defined in the analysisUtils, and might change in later releases of the allegroUtils.
Parameters: |
|
---|---|
Return float: | 2-dim array with timescales and 2-pt Deviation |
returns a dictionary with metadata from a MS.
Parameters: |
|
---|---|
Returns: | dictionary with metadata |
Return type: | dict |
The returned dictionary includes:
timequery - the timequery for the extraction of MS
date-obs - the time of the start of the observations
band - the ALMA Band
ref_freq - the reference frequency
spw - the spectral window ID of the reference frequency
pol - polarisations
pwv - pwv (mm)
weather - dictionary with weather data
The function reads in the phase stream and acts to minimise a scaling factor according to the given timescale of the tpd OR rms values
assumes that there is a smooth minimum such that corse looping is used to narrow down the value
Parameters: |
|
---|---|
Returns: | the scale value |
Return type: | float |
Dedicated function to plot the Allan Deviation, Phase and the antenna/baseline configuration.
Parameters: |
|
---|
Analyse the data products and generates fits tables with the Two-Point Deviation for each dataset.
Parameters: |
|
---|---|
Returns: | If no file prefix is given then nothing is output |
Return type: | dict |
Analyse the data products and generates fits tables with the Two-Point Deviation for each dataset.
Parameters: |
|
---|---|
Returns: | If no file prefix is given, nothing is returned |
Return type: | dict |
Checks if the MySQL database already contains information on the UID in questions
Parameters: | results – UID name |
---|---|
Returns: | None or string with missing entries |
Return type: | str |
Parameters: | results – UID name of the fits file |
---|---|
Returns: | None |
Return type: | None |
Out of Date, use putentry3 Enters the required values of a reduced asdm into the new style sql databas (comparenew.db)
Parameters: | results – UID fits file |
---|---|
Returns: | None |
Return type: | None |
Enters the required values of a reduced asdm into the new style sql databas (comparenew.db) :param results: UID fits file. :param database_name: name of database to connect to and enter stats into. :param antenna_out: list of antennas to be excluded. Separated by a comma. :param baseline_out: list of baselines to exclude. syntax e.g. DV14-DA64,DV12-DA60,... :type results: str :type database_name: str :type antenna_out: str :type baseline_out: str :returns: None :rtype: None
Function to apply Phase solution to the data
Note
Currently, we only replace the MS file. Do we also want to replace the viswvr and wvr files?
Function to select 2-PT deviations from a specified database and plot these vs the baseline. Binning, limits, order and y-axis output can all be specified
Parameters: |
|
---|
make a plot showing all data points Function of baseline length and PWV. Color shows band
makes a scatter plot for each band from the entries in the SQL database. xa = Column to be plotted on X-Axis (standard = baseline length) ya = Column to be plotted on Y-Axis (standard = ratio) cscale = colorscale of points (standard = pwv). dobin = make a constraint constraint = identify column to perform cut (standard = pwv) bin = upper and lower limit of constraints (standard = [0.5,1.0]) doXlog/doYlog = make X/Y axis on logscale (standard = False)
Extracts the time, elevation, and the measurement of the 4 WVR channels for each antenna from the measurement set and returns a dictionary with the data stored as [4, nint]-numpy arrays.
Parameters: | |
---|---|
Returns: | time, elevation, Tsky |
Return type: | dict |
Calculate and apply the WVR table to an ms
Parameters: |
---|
Check whether wvr calibration has already been applied to the dataset. This is done by checking the log history of the measurement set
Parameters: | vis (string) – measurement set |
---|---|
Returns: | WVR calibration applied? |
Return type: | boolean |
literally a script to image the BP calibrator in a dataset that is field 0, although one can change this. A dirty map, shallow and deep clean are undertaken. Run in own directory as file outputs are default names
Parameters: | |
---|---|
Returns: | 3 images with default naming |
Plots the pwv vs. time.
Parameters: |
---|
Input can be time and pwv as arrays. Optionally, time and pwv can also be dictionaries, where each of the dictionary items is an array with the time,pwv values for a certain antenna.
So it would be possible to plot pwv for both t, pwv and tD, pwvD:
>>> t, pwv
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]),
array([ 0.94126768, 0.37091606, -0.20220262, -1.86810555, 0.54127135, -0.06986392, 0.52915721, 1.05361894, 1.48919136, 0.28908486]))
>>> tD, pwdD
({0: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]),
1: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])},
{0: array([ 0.94126768, 0.37091606, -0.20220262, -1.86810555, 0.54127135, -0.06986392, 0.52915721, 1.05361894, 1.48919136, 0.28908486]),
1: array([-0.77326468, 0.75096047, 0.46097048, 0.10453903, -0.18425609, 0.97326987, -1.49004715, -0.38477006, -2.68286378, -0.8755046 ])})
extracts measured pwv from each antenna
Parameters: | |
---|---|
Returns: | time,pwv |
Return type: | dict |
calculates the PWV from the WVR data in the MS. Optionally, the PWV can be corrected to PWV_zenith, using the elevation and zenith keywords.
Parameters: |
|
---|---|
Returns: | PWV (in mm) |
Return type: | float array |