Skip to content

Commit

Permalink
Merge pull request #13 from sot/de-namespace
Browse files Browse the repository at this point in the history
De-namespace
  • Loading branch information
taldcroft authored Jan 23, 2023
2 parents c3eeb01 + 90c0827 commit 3288acf
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 26 deletions.
12 changes: 6 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Ska.ParseCM documentation build configuration file, created by
# ska_parsecm documentation build configuration file, created by
# sphinx-quickstart on Tue May 19 15:46:11 2020.
#
# This file is execfile()d with the current directory set to its
Expand All @@ -20,7 +20,7 @@
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
from Ska.ParseCM import __version__
from ska_parsecm import __version__

# -- General configuration ------------------------------------------------

Expand Down Expand Up @@ -49,7 +49,7 @@
master_doc = 'index'

# General information about the project.
project = 'Ska.ParseCM'
project = 'ska_parsecm'
copyright = '2020, Tom Aldcroft'
author = 'Tom Aldcroft'

Expand Down Expand Up @@ -153,7 +153,7 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'SkaParseCM.tex', 'Ska.ParseCM Documentation',
(master_doc, 'SkaParseCM.tex', 'ska_parsecm Documentation',
'Tom Aldcroft', 'manual'),
]

Expand All @@ -163,7 +163,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'chandratime', 'Ska.ParseCM Documentation',
(master_doc, 'chandratime', 'ska_parsecm Documentation',
[author], 1)
]

Expand All @@ -174,7 +174,7 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'SkaParseCM', 'Ska.ParseCM Documentation',
(master_doc, 'SkaParseCM', 'ska_parsecm Documentation',
author, 'SkaParseCM', 'One line description of project.',
'Miscellaneous'),
]
Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:mod:`Ska.ParseCM`
:mod:`ska_parsecm`
========================

.. automodule:: Ska.ParseCM
.. automodule:: ska_parsecm.ParseCM
:members:
21 changes: 15 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
from setuptools import setup
from ska_helpers.setup_helper import duplicate_package_info

setup(name='Ska.ParseCM',
name = "ska_parsecm"
namespace = "Ska.ParseCM"

packages = ["ska_parsecm"]
package_dir = {name: name}

duplicate_package_info(packages, name, namespace)
duplicate_package_info(package_dir, name, namespace)


setup(name=name,
author = 'CXC Aspect',
description='Parse MP command management files',
maintainer_email = 'aldcroft@head.cfa.harvard.edu',
py_modules = ['Ska.ParseCM'],
maintainer_email = 'taldcroft@cfa.harvard.edu',
use_scm_version=True,
setup_requires=['setuptools_scm', 'setuptools_scm_git_archive'],
test_suite='test',
zip_safe=False,
packages=['Ska'],
package_dir={'Ska' : 'Ska'},
package_data={}
packages=packages,
package_dir=package_dir,
)
6 changes: 1 addition & 5 deletions Ska/ParseCM.py → ska_parsecm/ParseCM.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@

# Warn about deprecation but use FutureWarning so it actually shows up (since
# DeprecationWarning is ignored by default)
warnings.warn('Ska.ParseCM is deprecated, use parse_cm instead', FutureWarning)

import ska_helpers

__version__ = ska_helpers.get_version(__name__)
warnings.warn('ska_parsecm is deprecated, use parse_cm instead', FutureWarning)


def _coerce_type(val):
Expand Down
7 changes: 7 additions & 0 deletions ska_parsecm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

import ska_helpers

from .ParseCM import * # noqa

__version__ = ska_helpers.get_version("ska_parsecm")
17 changes: 10 additions & 7 deletions test.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import os
import unittest
import Ska.ParseCM
import ska_parsecm
import glob

SKA = os.environ['SKA']

class Tests(unittest.TestCase):
def test_05_read_backstop(self):
bs = Ska.ParseCM.read_backstop('/data/mpcrit1/mplogs/2009/FEB0209/oflsa/CR032_1103.backstop')
bs = ska_parsecm.read_backstop(f'{SKA}/data/mpcrit1/mplogs/2009/FEB0209/oflsa/CR032_1103.backstop')
self.assertEqual(len(bs), 2090)
self.assertEqual(bs[3]['params']['TLMSID'], 'AONMMODE')

def test_10_read_2008_backstops(self):
for bsfile in glob.glob('/data/mpcrit1/mplogs/2008/*/ofls/*.backstop'):
bs = Ska.ParseCM.read_backstop(bsfile)
for bsfile in glob.glob(f'{SKA}/data/mpcrit1/mplogs/2008/*/ofls/*.backstop'):
bs = ska_parsecm.read_backstop(bsfile)
self.assertEqual(len(bs), len(open(bsfile).readlines()))

def test_15_read_mm(self):
mms = Ska.ParseCM.read_mm('/data/mpcrit1/mplogs/2009/MAR0209/oflsc/mps/mm059_2310.sum')
mms = ska_parsecm.read_mm(f'{SKA}/data/mpcrit1/mplogs/2009/MAR0209/oflsc/mps/mm059_2310.sum')
self.assertEqual(mms[0]['initial']['obsid'], 10870)

def test_20_read_2008_mms(self):
for mmfile in glob.glob('/data/mpcrit1/mplogs/2008/*/ofls/mps/mm*.sum'):
mms = Ska.ParseCM.read_mm(mmfile)
for mmfile in glob.glob(f'{SKA}/data/mpcrit1/mplogs/2008/*/ofls/mps/mm*.sum'):
mms = ska_parsecm.read_mm(mmfile)

if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(Tests)
Expand Down

0 comments on commit 3288acf

Please sign in to comment.