from starlit.bib.bibtexdb import BibTexDB
from starlit.bib.adsdb import ADSBibDB
from starlit.bib.adscache import ADSCacheDB
bibdb = BibTexDB("/Users/jsick/Dropbox/Papers/master.bib")
WARNING:bibtexparser.bparser:Entry type periodical not standard. Not considered. WARNING:bibtexparser.bparser:Entry type periodical not standard. Not considered. WARNING:bibtexparser.bparser:Entry type electronic not standard. Not considered. WARNING:bibtexparser.bparser:Entry type electronic not standard. Not considered. WARNING:bibtexparser.bparser:Entry type electronic not standard. Not considered. WARNING:bibtexparser.bparser:Entry type link not standard. Not considered. WARNING:bibtexparser.bparser:Entry type electronic not standard. Not considered. WARNING:bibtexparser.bparser:Entry type electronic not standard. Not considered. WARNING:bibtexparser.bparser:Entry type webpage not standard. Not considered.
cachedb = ADSCacheDB(host='localhost', port=27017, ads_db=ADSBibDB())
uncached_adsdb = ADSBibDB()
adsdb = ADSBibDB(cache=cachedb)
sick_pub = bibdb['Sick:2014']
sick_pub.reference_bibcodes
[u'2014ASPC..480...39S', u'2014RvMP...86...47C', u'2013ARA&A..51..393C', u'2012ApJS..200...18D', u'2012MNRAS.422.3285P', u'2011MNRAS.418.1587T', u'2011ApJ...739...20C', u'2010ApJ...712..833C', u'2010A&A...509A..61S', u'2009ApJS..184..152B', u'2009Natur.461...66M', u'2008ApJ...685L.121B', u'2008ASPC..394...83B', u'2008ASPC..394..619M', u'2008A&A...482..883M', u'2007IAUS..241..125B', u'2007ApJ...658L..91B', u'2006ApJ...652...85M', u'2006ApJ...652..323B', u'2006ApJ...650L..45B', u'2006MNRAS.370.1499A', u'2006AJ....132..271O', u'2006ASPC..351..112B', u'2006AJ....131.2478M', u'2006AJ....131.1163S', u'2005ApJ...634..287I', u'2005ApJ...631..820W', u'2005MNRAS.362..799M', u'2005ApJ...628L.105I', u'2005ApJ...619..218D', u'2005MNRAS.356..979M', u'2004SPIE.5492..978P', u'2004ARA&A..42..603K', u'2004PASP..116..640V', u'2004ApJS..152..175M', u'2003AJ....126.1312W', u'2003ApJ...592L..17B', u'2002MNRAS.331..293W', u'2002ASPC..281..228B', u'1998MNRAS.300..872M', u'1996A&AS..117..393B', u'1996A&A...313..377D']
sick_ads_pub_1 = uncached_adsdb[sick_pub.bibcode]
print(sick_ads_pub_1)
print(sick_ads_pub_1.citation_bibcodes)
print(sick_ads_pub_1.reference_bibcodes)
<starlit.bib.adsdb.ADSPub object at 0x105edc350> [u'2014A&A...567A..71V', u'2014ASPC..480...39S', u'2014ApJS..210....4M'] [u'2014ASPC..480...39S', u'2014RvMP...86...47C', u'2013ARA&A..51..393C', u'2012ApJS..200...18D', u'2012MNRAS.422.3285P', u'2011MNRAS.418.1587T', u'2011ApJ...739...20C', u'2010ApJ...712..833C', u'2010A&A...509A..61S', u'2009ApJS..184..152B', u'2009Natur.461...66M', u'2008ApJ...685L.121B', u'2008ASPC..394...83B', u'2008ASPC..394..619M', u'2008A&A...482..883M', u'2007IAUS..241..125B', u'2007ApJ...658L..91B', u'2006ApJ...652...85M', u'2006ApJ...652..323B', u'2006ApJ...650L..45B', u'2006MNRAS.370.1499A', u'2006AJ....132..271O', u'2006ASPC..351..112B', u'2006AJ....131.2478M', u'2006AJ....131.1163S', u'2005ApJ...634..287I', u'2005ApJ...631..820W', u'2005MNRAS.362..799M', u'2005ApJ...628L.105I', u'2005ApJ...619..218D', u'2005MNRAS.356..979M', u'2004SPIE.5492..978P', u'2004ARA&A..42..603K', u'2004PASP..116..640V', u'2004ApJS..152..175M', u'2003AJ....126.1312W', u'2003ApJ...592L..17B', u'2002MNRAS.331..293W', u'2002ASPC..281..228B', u'1998MNRAS.300..872M', u'1996A&AS..117..393B', u'1996A&A...313..377D']
sick_ads_pub = adsdb[sick_pub.bibcode]
print(sick_ads_pub)
<starlit.bib.adscache.CachePub object at 0x105a7d110>
pub = adsdb['2011MNRAS.418.1587T']
print(pub._ads_db is None)
print(pub)
print(pub.title)
print(pub.authors)
print(pub.abstract)
print(pub.title)
print(pub.references)
False <starlit.bib.adscache.CachePub object at 0x105d56250> Galaxy And Mass Assembly (GAMA): stellar mass estimates [] This paper describes the first catalogue of photometrically derived stellar mass estimates for intermediate-redshift (z < 0.65; median z= 0.2) galaxies in the Galaxy And Mass Assembly (GAMA) spectroscopic redshift survey. These masses, as well as the full set of ancillary stellar population parameters, will be made public as part of GAMA data release 2. Although the GAMA database does include near-infrared (NIR) photometry, we show that the quality of our stellar population synthesis fits is significantly poorer when these NIR data are included. Further, for a large fraction of galaxies, the stellar population parameters inferred from the optical-plus-NIR photometry are formally inconsistent with those inferred from the optical data alone. This may indicate problems in our stellar population library, or NIR data issues, or both; these issues will be addressed for future versions of the catalogue. For now, we have chosen to base our stellar mass estimates on optical photometry only. In light of our decision to ignore the available NIR data, we examine how well stellar mass can be constrained based on optical data alone. We use generic properties of stellar population synthesis models to demonstrate that restframe colour alone is in principle a very good estimator of stellar mass-to-light ratio, M<SUB>*</SUB>/L<SUB>i</SUB>. Further, we use the observed relation between restframe (g-i) and M<SUB>*</SUB>/L<SUB>i</SUB> for real GAMA galaxies to argue that, modulo uncertainties in the stellar evolution models themselves, (g-i) colour can in practice be used to estimate M<SUB>*</SUB>/L<SUB>i</SUB> to an accuracy of ≲0.1 dex (1σ). This 'empirically calibrated' (g-i)-M<SUB>*</SUB>/L<SUB>i</SUB> relation offers a simple and transparent means for estimating galaxies' stellar masses based on minimal data, and so provides a solid basis for other surveys to compare their results to z≲0.4 measurements from GAMA. Galaxy And Mass Assembly (GAMA): stellar mass estimates
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-26-4cca9193eef8> in <module>() 7 print(pub.abstract) 8 print(pub.title) ----> 9 print(pub.references) /Users/jsick/code/_paperweight/starlit/starlit/bib/adscache.py in references(self) 87 pubs = [self._ads_db[bibcode] for bibcode in bibcodes] 88 return pubs ---> 89 else: 90 return bibcodes 91 /Users/jsick/code/_paperweight/starlit/starlit/bib/adsdb.pyc in __getitem__(self, bibcode) 44 # or query from ADS 45 ads_query = ads.query(query=bibcode) ---> 46 pub = ADSPub(ads_query.next()) 47 48 # cache it if we can /Users/jsick/.virtualenvs/paperweight/lib/python2.7/site-packages/ads-0.0.809-py2.7.egg/ads/core.py in next(self) 383 if len(self.retrieved_articles) == 0: 384 active_request = self.active_requests.pop(0) --> 385 response = active_request.result().json() 386 387 if "error" in response: /Users/jsick/.virtualenvs/paperweight/lib/python2.7/site-packages/requests/models.pyc in json(self, **kwargs) 795 # used. 796 pass --> 797 return json.loads(self.text, **kwargs) 798 799 @property /usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.pyc in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 336 parse_int is None and parse_float is None and 337 parse_constant is None and object_pairs_hook is None and not kw): --> 338 return _default_decoder.decode(s) 339 if cls is None: 340 cls = JSONDecoder /usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.pyc in decode(self, s, _w) 364 365 """ --> 366 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 367 end = _w(s, end).end() 368 if end != len(s): /usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.pyc in raw_decode(self, s, idx) 382 obj, end = self.scan_once(s, idx) 383 except StopIteration: --> 384 raise ValueError("No JSON object could be decoded") 385 return obj, end ValueError: No JSON object could be decoded