radis.tools.track_ref module¶
Experiment module to track references used in the code; and return the appropriate citations
To be made an independent package in the future
- class RefTracker(**kwargs)[source]¶
Bases:
dict
Track bibliographic references by storing the DOIs in a dictionary.
Prints them nicely using the
habanero
CrossRef API package.Examples
rt = RefTracker() # in your code: rt.add("10.1016/a.test.2021.012345", "algorithm") rt.add("10.1016/a.test.2021.012345", "post-processing") rt.add("10.1016/a.test.2021.678910", "data retrieval") rt.add("10.1016/a.test.2021.111213", "data retrieval") # user part: rt.cite()
Returns:
----------------------------------- @article{DUMMY_KEY, doi = 10.1016/a.test.2021.012345, title = PLACEHOLDER FOR 10.1016/a.test.2021.012345 in bibentry format } Used for data retrieval ----------------------- @article{DUMMY_KEY, doi = 10.1016/a.test.2021.678910, title = PLACEHOLDER FOR 10.1016/a.test.2021.678910 in bibentry format } @article{DUMMY_KEY, doi = 10.1016/a.test.2021.111213, title = PLACEHOLDER FOR 10.1016/a.test.2021.111213 in bibentry format }
Other Example¶
Can be initialized from an existing dict (useful when serializing with JSON)
ref_dict = {'10.1016/a.test.2021.012345': ['algorithm', 'post-processing'], '10.1016/a.test.2021.678910': ['data retrieval'], '10.1016/a.test.2021.111213': ['data retrieval']} rt = RefTracker(**ref_dict) rt.cite()
Returns:
----------------------------------- @article{DUMMY_KEY, doi = 10.1016/a.test.2021.012345, title = PLACEHOLDER FOR 10.1016/a.test.2021.012345 in bibentry format } Used for data retrieval ----------------------- @article{DUMMY_KEY, doi = 10.1016/a.test.2021.678910, title = PLACEHOLDER FOR 10.1016/a.test.2021.678910 in bibentry format } @article{DUMMY_KEY, doi = 10.1016/a.test.2021.111213, title = PLACEHOLDER FOR 10.1016/a.test.2021.111213 in bibentry format }
See also