text stringlengths 81 112k |
|---|
Update the ossuary Postgres db with images observed for OSSOS.
iq: Go through and check all ossuary's images for new existence of IQs/zeropoints.
comment: Go through all ossuary and
Then updates ossuary with new images that are at any stage of processing.
Constructs full image entries, including header ... |
Compute a "square" view of the frequency adaptive transform, by
resampling each frequency band such that they all contain the same
number of samples, and performing an overlap-add procedure in the
case where the sample frequency and duration differ
:param n_coeffs: The common size to whi... |
Convert a point from one coordinate system to another.
Args:
point: tuple(int x, int y)
The point in the original coordinate system.
Returns:
converted_point: tuple(int x, int y)
The point in the new coordinate system.
Example: convert coordinate fr... |
Create sane default persistence settings for learning pipelines
:param cls: The class to decorate
def simple_settings(cls):
"""
Create sane default persistence settings for learning pipelines
:param cls: The class to decorate
"""
class Settings(ff.PersistenceSettings):
_id = cls.__name... |
Apply a pytorch network, potentially in chunks
def apply_network(network, x, chunksize=None):
"""
Apply a pytorch network, potentially in chunks
"""
network_is_cuda = next(network.parameters()).is_cuda
x = torch.from_numpy(x)
with torch.no_grad():
if network_is_cuda:
x = x... |
pixel norm as described in section 4.2 here:
https://arxiv.org/pdf/1710.10196.pdf
def sample_norm(x):
"""
pixel norm as described in section 4.2 here:
https://arxiv.org/pdf/1710.10196.pdf
"""
original = x
# square
x = x ** 2
# feature-map-wise sum
x = torch.sum(x, dim=1)
# s... |
Reset the source location based on the init_skycoord values
@return:
def reset_coord(self):
"""
Reset the source location based on the init_skycoord values
@return:
"""
(x, y, idx) = self.world2pix(self.init_skycoord.ra,
self.init_sky... |
Return the coordinates of the source in the cutout reference frame.
@return:
def pixel_coord(self):
"""
Return the coordinates of the source in the cutout reference frame.
@return:
"""
return self.get_pixel_coordinates(self.reading.pix_coord, self.reading.get_ccd_num()) |
The SourceCutout is a list of HDUs, this method returns the index of the HDU that corresponds to the given
ccd number. CCDs are numbers from 0, but the first CCD (CCDNUM=0) is often in extension 1 of an MEF.
@param ccdnum: the number of the CCD in the MEF that is being referenced.
@return: the ... |
Sometimes we 'flipped' the X/Y coordinates of the image during processing. This function takes an
(x,y) location from the processing pipeline and returns the x/y location relative to the original
reference frame. (Correctly checks if the coordinate is flipped to begin with.)
This is only for... |
Update the x/y location of the associated reading by using new_pixel_location and transforming from cutout
reference frame to observation refrence frame.
@param new_pixel_location: (x, y) location of the source in cutout pixel reference frame
@param hdu_index: index of the associate hdu in the h... |
Retrieves the pixel location of a point within the current HDUList given the
location in the original FITS image. This takes into account that
the image may be a cutout of a larger original.
Args:
point: tuple(float, float)
(x, y) in original.
Returns:
... |
Retrieves the location of a point using the coordinate system of
the original observation, i.e. the original image before any
cutouts were done.
Returns:
(x, y) in the original image coordinate system.
@param x: x-pixel location in the cutout frame of reference
@pa... |
Convert a given RA/DEC position to the X/Y/HDULIST_INDEX in the cutout frame.
Here we loop over the hdulist to find the extension is RA/DEC are from and then return the appropriate X/Y
:param ra: The Right Ascension of the point
:type ra: Quantity
:param dec: The Declination of the po... |
Return the photometric zeropoint of the CCD associated with the reading.
@return: float
def zmag(self,):
"""
Return the photometric zeropoint of the CCD associated with the reading.
@return: float
"""
if self._zmag is None:
hdulist_index = self.get_hdulist_id... |
return the aperture correction of for the CCD assocated with the reading.
@return: Apcor
def apcor(self):
"""
return the aperture correction of for the CCD assocated with the reading.
@return: Apcor
"""
if self._apcor is None:
try:
self._apcor... |
Get the magnitude at the current pixel x/y location.
:return: Table
def get_observed_magnitude(self, centroid=True):
# NOTE: this import is only here so that we don't load up IRAF
# unnecessarily (ex: for candidates processing).
"""
Get the magnitude at the current pixel x/y lo... |
IRAF routines such as daophot need input on disk.
Returns:
filename: str
The name of the file containing the FITS data.
def _hdu_on_disk(self, hdulist_index):
"""
IRAF routines such as daophot need input on disk.
Returns:
filename: str
The n... |
returns a list of possible comparison images for the current cutout. Will query CADC to create the list when
first called.
@rtype: Table
def comparison_image_list(self):
"""
returns a list of possible comparison images for the current cutout. Will query CADC to create the list when
... |
Search the DB for a comparison image for this cutout.
def retrieve_comparison_image(self):
"""
Search the DB for a comparison image for this cutout.
"""
# selecting comparator when on a comparator should load a new one.
collectionID = self.comparison_image_list[self.comparison_i... |
check that the passwd provided matches the required password.
def check_password(self, passwd, group):
# This provides authentication via CADC.
"""check that the passwd provided matches the required password."""
return gms.isMember(self.login, passwd, group) |
Transform a :class:`TimeSlice` into integer indices that numpy can work
with
Args:
ts (slice, TimeSlice): the time slice to translate into integer
indices
def integer_based_slice(self, ts):
"""
Transform a :class:`TimeSlice` into integer indices that numpy c... |
Returns a provisional name based dictionary of observations of the object.
Each observations is keyed on the date. ie. a dictionary of dictionaries.
@param path: the directory where filenames are.
@type path str
@param filenames: list of files in path.
@type filenames list
@rtype None
def loa... |
Add KBOs to an image
:param filename: name of the image to add KBOs to
:param psf: the Point Spread Function in IRAF/DAOPHOT format to be used by ADDSTAR
:param kbos: list of KBOs to add, has format as returned by KBOGenerator
:param shifts: dictionary with shifts to transfer to coordinates to reference... |
Plant artificial sources into the list of images provided.
:param expnums: list of MegaPrime exposure numbers to add artificial KBOs to
:param ccd: which ccd to work on.
:param rmin: The minimum rate of motion to add sources at (''/hour)
:param rmax: The maximum rate of motion to add sources at (''/hou... |
call fit_radec of BK passing in the observations.
def _fit_radec(self):
"""
call fit_radec of BK passing in the observations.
"""
# call fitradec with mpcfile, abgfile, resfile
self.orbfit.fitradec.restype = ctypes.c_int
self.orbfit.fitradec.argtypes = [ ctypes.c_char_... |
use the bk predict method to compute the location of the source on the given date.
def predict(self, date, obs_code=568):
"""
use the bk predict method to compute the location of the source on the given date.
"""
time = Time(date, scale='utc', precision=6)
jd = ctypes.c_double(t... |
Decorator to make sure the function is called from wx's main GUI
thread. This is needed when trying to trigger UI updates from a thread
other than the main GUI thread (such as some asynchronous data loading
thread).
I learned about doing this from:
wxPython 2.8 Application Development Cookbook, Ch... |
Write a file in the crazy MOP format given an mop data hdu.
def write(file,hdu,order=None,format=None):
"""Write a file in the crazy MOP format given an mop data hdu."""
if order or format:
warnings.warn('Use of <order> and <format> depricated',DeprecationWarning)
## if the order of the columns ... |
Write the contents of a MOP data structure to a SQL table
def store(hdu,dbase='cfeps',duser='cfhls',dtype='MYSQL',table='source'):
"""Write the contents of a MOP data structure to a SQL table"""
import MOPdbaccess
db=MOPdbaccess.connect(dbase,duser,dbSystem=dtype)
dbc=db.cursor()
### INSERT THE '... |
Read in a file and create a data strucuture that is a hash with members 'header'
and 'data'. The 'header' is a hash of header keywords, the data is a hash of columns.
To get to the nth element of column NAME use hdu[data][NAME][n]. To get the header
information use hdu[header][KEYWORD].
def read(file):
... |
Given a list of MOPfiles merge them based on x/y coordinates matching..
def xymatch(outfile, filenames, tol=2):
"""Given a list of MOPfiles merge them based on x/y coordinates matching.."""
import math
import sys
output={}
files=[]
for filename in filenames:
this_file=read(filename)
... |
r"""Prepare logging dict suitable with ``logging.config.dictConfig``.
**Usage**::
from logging.config import dictConfig
dictConfig(default_logging_dict('yourlogger'))
:param \*loggers: Enable logging for each logger in sequence.
:param \*\*kwargs: Setup additional logger params via keywor... |
r"""Enable Sentry logging if Sentry DSN passed.
.. note::
Sentry logging requires `raven <http://pypi.python.org/pypi/raven>`_
library to be installed.
**Usage**::
from logging.config import dictConfig
LOGGING = default_logging_dict()
SENTRY_DSN = '...'
updat... |
TRIM a CFHT MEGAPRIME frame using the DATASEC keyword
def trim(hdu, datasec='DATASEC'):
"""TRIM a CFHT MEGAPRIME frame using the DATASEC keyword"""
datasec = re.findall(r'(\d+)',
hdu.header.get(datasec))
l = int(datasec[0]) - 1
r = int(datasec[1])
b = int(datasec[2]) - 1
... |
extra fun as this is space-separated so using CSV parsers is not an option
def ossos_release_parser(table=False, data_release=parameters.RELEASE_VERSION):
"""
extra fun as this is space-separated so using CSV parsers is not an option
"""
names = ['cl', 'p', 'j', 'k', 'sh', 'object', 'mag', 'e_mag', 'Fi... |
Returns a list of objects holding orbfit.Orbfit objects with the observations in the Orbfit.observations field.
Default is to return only the objects corresponding to the current Data Release.
def ossos_discoveries(directory=parameters.REAL_KBO_AST_DIR,
suffix='ast',
no_... |
Wrap the objects from the Version Releases together with the objects instantiated from fitting their mpc lines
def ossos_release_with_metadata():
"""
Wrap the objects from the Version Releases together with the objects instantiated from fitting their mpc lines
"""
# discoveries = ossos_release_parser()... |
Load a Survey Simulator model file as an array of ephem EllipticalBody objects.
@param model_file:
@return:
def _kbos_from_survey_sym_model_input_file(model_file):
"""
Load a Survey Simulator model file as an array of ephem EllipticalBody objects.
@param model_file:
@return:
"""
lines =... |
Return a string of the number and its uncertainty to the right sig figs via uncertainty's print methods.
The uncertainty determines the sig fig rounding of the number.
https://pythonhosted.org/uncertainties/user_guide.html
def round_sig_error(num, uncert, pm=False):
"""
Return a string of the number an... |
parse eLCM response body as json data
eLCM response should be in form of:
_
Key1: value1 <-- optional -->
Key2: value2 <-- optional -->
KeyN: valueN <-- optional -->
- CRLF -
JSON string
-
:param response: eLCM response
:return: json object if success
:raise ELCMInvali... |
send an eLCM request to the server
:param irmc_info: dict of iRMC params to access the server node
{
'irmc_address': host,
'irmc_username': user_id,
'irmc_password': password,
'irmc_port': 80 or 443, default is 443,
'irmc_auth_method': 'basic' or 'digest', ... |
send an eLCM request to get profile versions
:param irmc_info: node info
:returns: dict object of profiles if succeed
{
"Server":{
"@Version": "1.01",
"AdapterConfigIrmc":{
"@Version": "1.00"
},
"HWConfigura... |
send an eLCM request to get profile data
:param irmc_info: node info
:param profile_name: name of profile
:returns: dict object of profile data if succeed
:raises: ELCMProfileNotFound if profile does not exist
:raises: SCCIClientError if SCCI failed
def elcm_profile_get(irmc_info, profile_name):
... |
send an eLCM request to create profile
To create a profile, a new session is spawned with status 'running'.
When profile is created completely, the session ends.
:param irmc_info: node info
:param param_path: path of profile
:returns: dict object of session info if succeed
{
'Ses... |
send an eLCM request to set param values
To apply param values, a new session is spawned with status 'running'.
When values are applied or error, the session ends.
:param irmc_info: node info
:param input_data: param values to apply, eg.
{
'Server':
{
'SystemCon... |
send an eLCM request to delete a profile
:param irmc_info: node info
:param profile_name: name of profile
:raises: ELCMProfileNotFound if the profile does not exist
:raises: SCCIClientError if SCCI failed
def elcm_profile_delete(irmc_info, profile_name):
"""send an eLCM request to delete a profile... |
send an eLCM request to list all sessions
:param irmc_info: node info
:returns: dict object of sessions if succeed
{
'SessionList':
{
'Contains':
[
{ 'Id': id1, 'Name': name1 },
{ 'Id': id2, 'Name': name2 },
{ 'Id': i... |
send an eLCM request to get session status
:param irmc_info: node info
:param session_id: session id
:returns: dict object of session info if succeed
{
'Session':
{
'Id': id
'Status': status
...
}
}
:raises: ELCMSessionNo... |
send an eLCM request to terminate a session
:param irmc_info: node info
:param session_id: session id
:raises: ELCMSessionNotFound if the session does not exist
:raises: SCCIClientError if SCCI failed
def elcm_session_terminate(irmc_info, session_id):
"""send an eLCM request to terminate a session... |
send an eLCM request to remove a session from the session list
:param irmc_info: node info
:param session_id: session id
:param terminate: a running session must be terminated before removing
:raises: ELCMSessionNotFound if the session does not exist
:raises: SCCIClientError if SCCI failed
def elc... |
process session for Bios config backup/restore or RAID config operation
:param irmc_info: node info
:param operation: one of 'BACKUP_BIOS', 'RESTORE_BIOS' or 'CONFIG_RAID'
:param session_id: session id
:param session_timeout: session timeout
:return: a dict with following values:
{
... |
backup current bios configuration
This function sends a BACKUP BIOS request to the server. Then when the bios
config data are ready for retrieving, it will return the data to the
caller. Note that this operation may take time.
:param irmc_info: node info
:return: a dict with following values:
... |
restore bios configuration
This function sends a RESTORE BIOS request to the server. Then when the
bios
is ready for restoring, it will apply the provided settings and return.
Note that this operation may take time.
:param irmc_info: node info
:param bios_config: bios config
def restore_bios_... |
Get the status if secure boot is enabled or not.
:param irmc_info: node info.
:raises: SecureBootConfigNotFound, if there is no configuration for secure
boot mode in the bios.
:return: True if secure boot mode is enabled on the node, False otherwise.
def get_secure_boot_mode(irmc_info):
"... |
Enable/Disable secure boot on the server.
:param irmc_info: node info
:param enable: True, if secure boot needs to be
enabled for next boot, else False.
def set_secure_boot_mode(irmc_info, enable):
"""Enable/Disable secure boot on the server.
:param irmc_info: node info
:param ... |
Process raid input data.
:param target_raid_config: node raid info
:param raid_input: raid information for creating via eLCM
:raises ELCMValueError: raise msg if wrong input
:return: raid_input: raid input data which create raid configuration
{
"Server":{
"HWConfigurationI... |
Collect existing logical drives on the server.
:param raid_adapter: raid adapter info
:returns: existing_logical_drives: get logical drive on server
def _get_existing_logical_drives(raid_adapter):
"""Collect existing logical drives on the server.
:param raid_adapter: raid adapter info
:returns: e... |
Attempt delete exist adapter then create new raid adapter on the server.
:param irmc_info: node info
:returns: result: a dict with following values:
{
'raid_config': <data of raid adapter profile>,
'warning': <warning message if there is>
... |
Process raid_input then perform raid configuration into server.
:param irmc_info: node info
:param target_raid_config: node raid information
def create_raid_configuration(irmc_info, target_raid_config):
"""Process raid_input then perform raid configuration into server.
:param irmc_info: node info
... |
Delete whole raid configuration or one of logical drive on the server.
:param irmc_info: node info
def delete_raid_configuration(irmc_info):
"""Delete whole raid configuration or one of logical drive on the server.
:param irmc_info: node info
"""
# Attempt to get raid configuration on BM Server
... |
Set BIOS configurations on the server.
:param irmc_info: node info
:param settings: Dictionary containing the BIOS configuration.
:raise: BiosConfigNotFound, if there is wrong settings for bios
configuration.
def set_bios_configuration(irmc_info, settings):
"""Set BIOS configurations on the server... |
Get the current BIOS settings on the server
:param irmc_info: node info.
:returns: a list of dictionary BIOS settings
def get_bios_settings(irmc_info):
"""Get the current BIOS settings on the server
:param irmc_info: node info.
:returns: a list of dictionary BIOS settings
"""
bios_config... |
Context manager for adding resources for given router.
Main goal of context manager to easify process of adding resources with
routes to the router. This also allow to reduce amount of repeats, when
supplying new resources by reusing URL & name prefixes for all routes
inside context manager.
Behin... |
Convert Redis URL string to dict suitable to pass to
``aioredis.create_redis(...)`` call.
**Usage**::
async def connect_redis(url=None):
url = url or 'redis://localhost:6379/0'
return await create_redis(**get_aioredis_parts(url))
:param url: URL to access Redis instance, s... |
Generator that yields a dict of values corresponding to the
calendar date and time for the internal JD values.
Here we provide the additional 'fracday' element needed by 'mpc' format
def str_kwargs(self):
""" ... |
This is taken from the ogg vorbis spec
(http://xiph.org/vorbis/doc/Vorbis_I_spec.html)
:param s: the total length of the window, in samples
def oggvorbis(s):
"""
This is taken from the ogg vorbis spec
(http://xiph.org/vorbis/doc/Vorbis_I_spec.html)
:param s: the total length of the window, in... |
Converts the source (x, y) location from reading into the coordinate
system of reference_reading.
def convert_source_location(self, source_reading, reference_reading):
"""
Converts the source (x, y) location from reading into the coordinate
system of reference_reading.
"""
... |
Determines what the focal point of the downloaded image should be.
Returns:
focal_point: (x, y)
The location of the source in the middle observation, in the
coordinate system of the current source reading.
def calculate_focus(self, reading):
"""
Determines wha... |
Plot the OSSOS discoveries on a top-down Solar System showing the position of Neptune and model TNOs.
Discoveries are plotted each at their time of discovery according to the value in the Version Release.
Coordinates should be polar to account for RA hours, radial axis is in AU.
:return: a saved plot
T... |
plotted at their discovery locations, provided by the Version Releases in decimal degrees.
def plot_ossos_discoveries(ax, discoveries, plot_discoveries,
plot_colossos=False, split_plutinos=False):
"""
plotted at their discovery locations, provided by the Version Releases in decimal d... |
Brett: What are relevant and stunning are the actual orbit fit residuals
for orbits with d(a)/a<1%. I would be happy with a simple histogram of all those numbers,
although the 'tail' (probably blended and not yet completely flagged) should
perhaps be excluded. There will be a pretty clear gaussian I would ... |
Get irmc firmware version of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of bmc name and irmc firmware version.
def get_irmc_firmware_version(snmp_client):
"""Get irmc firmware version of the node.
:param snmp_client: an S... |
Get bios firmware version of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of bios firmware version.
def get_bios_firmware_version(snmp_client):
"""Get bios firmware version of the node.
:param snmp_client: an SNMP client ob... |
Get server model of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of server model.
def get_server_model(snmp_client):
"""Get server model of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SN... |
Return the authorization data for an SNMP request.
:returns: A
:class:`pysnmp.entity.rfc3413.oneliner.cmdgen.CommunityData`
object.
def _get_auth(self):
"""Return the authorization data for an SNMP request.
:returns: A
:class:`pysnmp.entity.rfc3413.oneliner... |
Use PySNMP to perform an SNMP GET operation on a single object.
:param oid: The OID of the object to get.
:raises: SNMPFailure if an SNMP request fails.
:returns: The value of the requested object.
def get(self, oid):
"""Use PySNMP to perform an SNMP GET operation on a single object.
... |
Use PySNMP to perform an SNMP GET NEXT operation on a table object.
:param oid: The OID of the object to get.
:raises: SNMPFailure if an SNMP request fails.
:returns: A list of values of the requested table object.
def get_next(self, oid):
"""Use PySNMP to perform an SNMP GET NEXT oper... |
Use PySNMP to perform an SNMP SET operation on a single object.
:param oid: The OID of the object to set.
:param value: The value of the object to set.
:raises: SNMPFailure if an SNMP request fails.
def set(self, oid, value):
"""Use PySNMP to perform an SNMP SET operation on a single o... |
Name if the MOP formatted file to parse.
@rtype: basestring
@return: filename
def filename(self):
"""
Name if the MOP formatted file to parse.
@rtype: basestring
@return: filename
"""
if self._filename is None:
self._filename = storage.get_fil... |
read in a file and return a MOPFile object.
def _parse(self):
"""read in a file and return a MOPFile object."""
with open(self.filename, 'r') as fobj:
lines = fobj.read().split('\n')
# Create a header object with content at start of file
self.header = MOPHeader(self.subfmt)... |
The astropy.table.Table object that will contain the data result
@rtype: Table
@return: data table
def table(self):
"""
The astropy.table.Table object that will contain the data result
@rtype: Table
@return: data table
"""
if self._table is None:
... |
Given a set of lines parse the into a MOP Header
def parser(self, lines):
"""Given a set of lines parse the into a MOP Header"""
while len(lines) > 0:
if lines[0].startswith('##') and lines[1].startswith('# '):
# A two-line keyword/value line starts here.
sel... |
Sometimes that MJD-OBS-CENTER keyword maps to a three component string, instead of a single value.
@param kw: a list of keywords
@param val: a list of matching values
@return: the MJD-OBS-CENTER as a julian date.
def _compute_mjd(self, kw, val):
"""
Sometimes that MJD-OBS-CENTER... |
Return a dictionary of information about a particular exposure
def getExpInfo(expnum):
"""Return a dictionary of information about a particular exposure"""
col_names=['object',
'e.expnum',
'mjdate',
'uttime',
'filter',
'elongation',
... |
Return a dictionary of information about a particular triple
def getTripInfo(triple):
"""Return a dictionary of information about a particular triple"""
col_names=['mjdate', 'filter', 'elongation', 'discovery','checkup', 'recovery', 'iq','block' ]
sql="SELECT mjdate md,"
sql=sql+" filter, avg(elongati... |
Get all exposures of specified pointing ID.
Default is to return a list of all exposure numbers
def getExpnums(pointing,night=None):
"""Get all exposures of specified pointing ID.
Default is to return a list of all exposure numbers"""
if night:
night=" floor(e.mjdate-0.0833)=%d " % ( night )... |
Get all triples of a specified pointing ID.
Defaults is to return a complete list triples.
def getTriples(pointing):
"""Get all triples of a specified pointing ID.
Defaults is to return a complete list triples."""
sql="SELECT id FROM triples t join triple_members m ON t.id=m.triple"
sql+=" join ... |
Add entries to the triples tables based on new images in the db
def createNewTriples(Win):
"""Add entries to the triples tables based on new images in the db"""
win.help("Building list of exposures to look for triples")
cols=('e.expnum', 'object',
'mjdate',
'uttime',
'elongation',
... |
Provide user with a list of triples that could be discovery triples
def setDiscoveryTriples(win,table="discovery"):
"""Provide user with a list of triples that could be discovery triples"""
win.help("Getting a list of pointings with triples from the CFEPS db")
pointings=getPointingsWithTriples()
win.... |
run the actual step1jmp/matt codes.
expnum: the CFHT expousre to process
ccd: which ccd in the mosaic to process
fwhm: the image quality, FWHM, of the image. In pixels.
sex_thresh: the detection threhold to run sExtractor at
wave_thresh: the detection threshold for wavelet
maxcount: saturation... |
Query the CADC TAP service to determine the list of images for the
NewHorizons Search. Things to determine:
a- Images to have the reference subtracted from.
b- Image to use as the 'REFERENCE' image.
c- Images to be used for input into the reference image
Logic: Given a particular Image/CCD find all the ... |
The SQL description of the source table
+-------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------+------+-----+---------+----------------+
| sourceID | int(11) | | PRI | NULL | auto_increment |
... |
Load the targets from a file
def load_edbfile(file=None):
"""Load the targets from a file"""
import ephem,string,math
if file is None:
import tkFileDialog
try:
file=tkFileDialog.askopenfilename()
except:
return
if file is None or file == '':
return
... |
Load the targets from a file
def load_abgfiles(dir=None):
"""Load the targets from a file"""
import ephem,string
if dir is None:
import tkFileDialog
try:
dir=tkFileDialog.askdirectory()
except:
return
if dir is None:
return None
from glob import glo... |
Get a list of files matching filter in directory root
def fits_list(filter,root,fnames):
"""Get a list of files matching filter in directory root"""
import re, pyfits, wcsutil
for file in fnames:
if re.match(filter,file):
fh=pyfits.open(file)
for ext in fh:
o... |
Load fits images in a directory
def load_fis(dir=None):
"""Load fits images in a directory"""
if dir is None:
import tkFileDialog
try:
dir=tkFileDialog.askdirectory()
except:
return
if dir is None:
return None
from os.path import walk
walk(dir... |
Draw the actual plot
def do_objs(kbos):
"""Draw the actual plot"""
import orbfit, ephem, math
import re
re_string=w.FilterVar.get()
vlist=[]
for name in kbos:
if not re.search(re_string,name):
continue
vlist.append(name)
if type(kbos[name])==type(ephem.Ellip... |
Print the canvas to a postscript file
def eps(self):
"""Print the canvas to a postscript file"""
import tkFileDialog,tkMessageBox
filename=tkFileDialog.asksaveasfilename(message="save postscript to file",filetypes=['eps','ps'])
if filename is None:
return
self.postscript(file=filename) |
Convert from canvas to screen coordinates
def c2s(self,p=[0,0]):
"""Convert from canvas to screen coordinates"""
return((p[0]-self.canvasx(self.cx1),p[1]-self.canvasy(self.cy1))) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.