Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONDecodeError when using eleanor.multi_sectors #260

Open
ojhall94 opened this issue Oct 19, 2022 · 0 comments
Open

JSONDecodeError when using eleanor.multi_sectors #260

ojhall94 opened this issue Oct 19, 2022 · 0 comments

Comments

@ojhall94
Copy link

ojhall94 commented Oct 19, 2022

Hi eleanor team!

I'm getting the following error when trying to search for data using eleanor. Weirdly, I got it this morning, then it went away for a bit, then it came back.

I'm using:

  • json v. 2.0.9
  • eleanor v. 2.0.5
  • Astropy v. 5.1
  • Python v. 3.10.4

The code is:

ra = 20.457083
dec = -42.022861
coords = SkyCoord(ra =ra, dec =j.dec, unit = (u.deg, u.deg))
star = eleanor.multi_sectors(coords = coords, sectors = 'all',
                                tc = True, tesscut_size=50)

And the error is:

File ~/Research/michael/Examples/../michael/data.py:90, in data_class.download_eleanor_data(self)
     80 """ Download Eleanor data.
     81 Data may not always be available due to not being observed by TESS, or
     82 errors in the download (which Im still trying to solve).
   (...)
     86 to a 13x13 postcard.
     87 """
     89 coords = SkyCoord(ra = self.j.ra, dec = self.j.dec, unit = (u.deg, u.deg))
---> 90 star = eleanor.multi_sectors(coords = coords, sectors = 'all',
     91                                 tc = True, tesscut_size=50)
     93 for s in star:
     94     try:

File /Users/Anaconda/anaconda3/envs/michael/lib/python3.10/site-packages/eleanor/source.py:78, in multi_sectors(sectors, tic, gaia, coords, name, tc, local, post_dir, pm_dir, metadata_path, tesscut_size)
     76 if (type(sectors) == list) or (type(sectors) == np.ndarray):
     77     for s in sectors:
---> 78         star = Source(tic=tic, gaia=gaia, coords=coords, sector=int(s), tc=tc,
     79                       local=local, post_dir=post_dir, pm_dir=pm_dir,
     80                       metadata_path=metadata_path, tesscut_size=tesscut_size)
     81         if star.sector is not None:
     82             objs.append(star)

File /Users/Anaconda/anaconda3/envs/michael/lib/python3.10/site-packages/eleanor/source.py:232, in Source.__init__(self, tic, gaia, coords, name, fn, sector, fn_dir, tc, local, post_dir, pm_dir, metadata_path, tesscut_size, tm)
    228     assert False, ("Source: invalid coords. Valid input types are: "
    229                    "(RA [deg], Dec [deg]) tuple or astropy.coordinates.SkyCoord object.")
    231 if self.tic is None:
--> 232     self.tic, self.tess_mag, sep, self.tic_version, self.contratio = tic_from_coords(self.coords)
    233 if (self.tess_mag is None) and (self.local is False):
    234     self.tic, self.tess_mag, sep, self.tic_version, self.contratio = tic_from_coords(self.coords)

File /Users/Anaconda/anaconda3/envs/michael/lib/python3.10/site-packages/eleanor/mast.py:175, in tic_from_coords(coords)
    173 def tic_from_coords(coords):
    174     """Returns TIC ID, Tmag, and separation of best match(es) to input coords."""
--> 175     tess = crossmatch_by_position(coords, 0.01, 'Mast.Tic.Crossmatch')
    176     tessPos = [tess['MatchRa'], tess['MatchDEC']]
    177     sepTess = crossmatch_distance(coords, tessPos)

File /Users/Anaconda/anaconda3/envs/michael/lib/python3.10/site-packages/eleanor/mast.py:138, in crossmatch_by_position(pos, r, service)
    133 request = {'service':service,
    134            'data':crossmatchInput,
    135            'params': {'raColumn':'ra', 'decColumn':'dec', 'radius':r},
    136            'format':'json', 'removecache':True}
    137 headers, outString = mastQuery(request)
--> 138 return jsonTable(json.loads(outString))

File /Users/Anaconda/anaconda3/envs/michael/lib/python3.10/json/__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    341     s = s.decode(detect_encoding(s), 'surrogatepass')
    343 if (cls is None and object_hook is None and
    344         parse_int is None and parse_float is None and
    345         parse_constant is None and object_pairs_hook is None and not kw):
--> 346     return _default_decoder.decode(s)
    347 if cls is None:
    348     cls = JSONDecoder

File /Users/Anaconda/anaconda3/envs/michael/lib/python3.10/json/decoder.py:337, in JSONDecoder.decode(self, s, _w)
    332 def decode(self, s, _w=WHITESPACE.match):
    333     """Return the Python representation of ``s`` (a ``str`` instance
    334     containing a JSON document).
    335 
    336     """
--> 337     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338     end = _w(s, end).end()
    339     if end != len(s):

File /Users/Anaconda/anaconda3/envs/michael/lib/python3.10/json/decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)
    353     obj, end = self.scan_once(s, idx)
    354 except StopIteration as err:
--> 355     raise JSONDecodeError("Expecting value", s, err.value) from None
    356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant