Skip to content
Snippets Groups Projects
Commit 28692128 authored by David Rafferty's avatar David Rafferty
Browse files

Fix registry check problem and masked value format warning

parent b16f0333
Branches
Tags
No related merge requests found
......@@ -24,6 +24,7 @@ from astropy.coordinates import Angle
from astropy.io import registry
import astropy.io.ascii as ascii
import numpy as np
import numpy.ma as ma
import re
import logging
import os
......@@ -255,6 +256,9 @@ def createTable(outlines, metaDict, colNames, colDefaults):
table.add_column(DecCol, index=DecIndx)
def fluxformat(val):
if type(val) is ma.core.MaskedConstant:
return '{}'.format(val)
else:
return '{0:0.3f}'.format(val)
table.columns['I'].format = fluxformat
......@@ -538,6 +542,7 @@ def skyModelIdentify(origin, *args, **kwargs):
Identifies valid makesourcedb sky model files.
"""
# Search for a format line. If found, assume file is valid
try:
if isinstance(args[0], basestring):
f = open(args[0])
elif isinstance(args[0], file_types):
......@@ -548,6 +553,8 @@ def skyModelIdentify(origin, *args, **kwargs):
if line.startswith("FORMAT") or line.startswith("format"):
return True
return False
except UnicodeDecodeError:
return False
def skyModelWriter(table, fileName):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment