Skip to content

Commit

Permalink
bugfix and lint. fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
christinahedges committed Jul 16, 2024
1 parent fa3e7db commit 8d42f54
Show file tree
Hide file tree
Showing 10 changed files with 1,090 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
sandbox/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
1,075 changes: 1,074 additions & 1 deletion poetry.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "lksearch"
version = "1.0.0"
version = "1.0.1"
description = "A helpful little package to search for TESS/Kepler/K2 data"
authors = ["TESS Science Support Center <[email protected]>"]
license = "MIT"
Expand Down Expand Up @@ -28,6 +28,9 @@ sphinx_rtd_theme = "^2.0.0"
sphinx_astropy = "^1.9.1"
sphinx_automodapi = "^0.17.0"
pydata-sphinx-theme = "^0.15.4"
jupyterlab = "^4.2.3"
line-profiler = "^4.1.3"
black = "^24.4.2"

[build-system]
requires = ["poetry-core"]
Expand Down
10 changes: 0 additions & 10 deletions src/lksearch/K2Search.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
from astroquery.mast import Observations
import pandas as pd
from typing import Union, Optional
import re
import logging
import warnings
import os

import numpy as np
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.table import Table
from astropy.time import Time

from copy import deepcopy

from .utils import SearchError, SearchWarning, suppress_stdout
from .MASTSearch import MASTSearch
from . import PACKAGEDIR, conf, config

pd.options.display.max_rows = 10

Expand Down Expand Up @@ -169,7 +160,6 @@ def filter_table(
campaign: Union[int, list] = None,
limit: int = None,
inplace=False,
**kwargs,
):
"""
Filters the search result table by specified parameters
Expand Down
11 changes: 1 addition & 10 deletions src/lksearch/KeplerSearch.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
from astroquery.mast import Observations
import pandas as pd
from typing import Union, Optional
import re
import logging
import warnings
import os

import numpy as np
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.table import Table
from astropy.time import Time

from copy import deepcopy

from .utils import SearchError, SearchWarning, suppress_stdout
from .MASTSearch import MASTSearch
from . import PACKAGEDIR, conf, config
from . import PACKAGEDIR

pd.options.display.max_rows = 10

Expand Down Expand Up @@ -255,7 +247,6 @@ def filter_table(
inplace=False,
quarter: Optional[int] = None,
month: Optional[int] = None,
**kwargs,
):
"""
Filters the search result table by specified parameters
Expand Down
13 changes: 4 additions & 9 deletions src/lksearch/MASTSearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from .utils import SearchError, SearchWarning, suppress_stdout

from . import PACKAGEDIR, conf, config
from . import conf, config

pd.options.display.max_rows = 10

Expand Down Expand Up @@ -845,8 +845,7 @@ def query_table(
self,
criteria: str,
inplace: bool = False,
**kwargs,
):
):
"""Filter the Search Result table using pandas query
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.query.html
Expand Down Expand Up @@ -1028,9 +1027,9 @@ def filter_table(
year: Union[int, list[int], tuple[int]] = None,
description: Union[str, list[str]] = None,
filetype: Union[str, list[str]] = None,
sequence: Union[str, list[str]] = None,
limit: int = None,
inplace=False,
**kwargs,
):
"""Filter the search by keywords
Expand Down Expand Up @@ -1066,10 +1065,6 @@ def filter_table(
MASTSearch or None
Returns a filtered MASTSearch object or None if `inplace=True`
"""
if "sequence" in kwargs:
sequence = kwargs["sequence"]
else:
sequence = None

mask = self._filter(
target_name=target_name,
Expand Down Expand Up @@ -1188,7 +1183,7 @@ def download(
for _, row in tqdm(
self.table.iterrows(),
total=self.table.shape[0],
desc="pipeline products",
desc="Downloading products",
)
]

Expand Down
8 changes: 2 additions & 6 deletions src/lksearch/TESSSearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@
from typing import Union, Optional
import re
import logging
import warnings
import os

import numpy as np
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.table import Table
from astropy.time import Time
from astroquery.mast import Tesscut

from tqdm import tqdm

from copy import deepcopy

from .utils import SearchError, SearchWarning, suppress_stdout
from .MASTSearch import MASTSearch
from . import PACKAGEDIR, conf, config
from . import conf, config

PREFER_CLOUD = conf.PREFER_CLOUD
DOWNLOAD_CLOUD = conf.DOWNLOAD_CLOUD
Expand Down Expand Up @@ -377,7 +374,6 @@ def filter_table(
limit: int = None,
inplace=False,
sector: Union[int, list[str]] = None,
**kwargs,
):
"""
Filters the search result table by specified parameters
Expand Down Expand Up @@ -508,7 +504,7 @@ def download(
).to_pandas()
# for sector in sector_list
for sector in tqdm(
sector_list, total=len(sector_list), desc="TESScut "
sector_list, total=len(sector_list), desc="Downloading TESScut"
)
]
if len(np.atleast_1d(mast_mf)) != 0:
Expand Down
5 changes: 1 addition & 4 deletions src/lksearch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/usr/bin/env python
from __future__ import absolute_import
from . import config as _config

from .version import __version__
import os

PACKAGEDIR = os.path.abspath(os.path.dirname(__file__))

from .version import __version__


class Conf(_config.ConfigNamespace):
"""
Configuration parameters for `search`.
Expand Down
4 changes: 1 addition & 3 deletions src/lksearch/utils.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import os
import sys
from functools import wraps

from . import config

default_download_dir = config.get_cache_dir()


from functools import wraps


class SearchError(Exception):
pass

Expand Down
2 changes: 1 addition & 1 deletion src/lksearch/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Store the version number in a separate file
# so that we can read it from setup.py without importing the package
__version__ = "1.0.0"
__version__ = "1.0.1"

0 comments on commit 8d42f54

Please sign in to comment.