From 0f010e07e9b8cb6eb4b522bf16c75ff6a3f60bca Mon Sep 17 00:00:00 2001 From: Ryan Lyttle Date: Mon, 13 Jan 2025 10:24:26 +0000 Subject: [PATCH 1/6] Created a a sorcha cite command line function Created a sorcha cite command line funtion with two optional arguments. An argument to print the citation to the terminal and an argument to decide the file path --- pyproject.toml | 1 + src/sorcha_cmdline/cite.py | 68 ++++++++++++++++++++++++++++++++++++++ src/sorcha_cmdline/main.py | 1 + 3 files changed, 70 insertions(+) create mode 100644 src/sorcha_cmdline/cite.py diff --git a/pyproject.toml b/pyproject.toml index 877008ea..0953a931 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,7 @@ sorcha-init = "sorcha_cmdline.init:main" sorcha-demo = "sorcha_cmdline.demo:main" sorcha-outputs = "sorcha_cmdline.outputs:main" sorcha-bootstrap = "sorcha_cmdline.bootstrap:main" +sorcha-cite = "sorcha_cmdline.cite:main" [project.urls] "Documentation" = "https://sorcha.readthedocs.io/en/latest/" diff --git a/src/sorcha_cmdline/cite.py b/src/sorcha_cmdline/cite.py new file mode 100644 index 00000000..b0f59eb9 --- /dev/null +++ b/src/sorcha_cmdline/cite.py @@ -0,0 +1,68 @@ +# +# The `sorcha cite` subcommand implementation +# +import argparse +from sorcha_cmdline.sorchaargumentparser import SorchaArgumentParser +import os + + +def main(): + parser = SorchaArgumentParser( + prog="sorcha cite", + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + description="Providing the bibtex, AAS Journals software latex command, and acknowledgement statements for Sorcha and the associated packages that power it in a file called sorcha_citation.txt.", + ) + + optional = parser.add_argument_group("Optional arguments") + optional.add_argument( + "-cf", + "--cite-file-path", + help="File path to store citation file sorcha_citation.txt.", + type=str, + dest="cf", + required=False, + default=os.getcwd(), + ) + + optional.add_argument( + "-p", + "--print", + help="Prints citation to terminal.", + dest="p", + action="store_true", + required=False, + ) + + args = parser.parse_args() + + return execute(args) + + +def execute(args): + import sys + import io + from sorcha.utilities.citation_text import cite_sorcha + + if args.p: # prints citation to terminal + cite_sorcha() + + if not os.path.isdir(args.cf): + sys.exit(f"ERROR: file path {args.cf} does not exist or isn't a directory") + + output_file_path = os.path.join(args.cf, "sorcha_citation.txt") + + # Makes sdtdout output the print statements into a temporary file + output_capture = io.StringIO() + sys.stdout = output_capture + + cite_sorcha() + + # writes the outputs in the temporary file to a text file + with open(output_file_path, "w") as output_file: + output_file.write(output_capture.getvalue()) + + # Resets stdout back to normal + sys.stdout = sys.__stdout__ + output_capture.close() + + print(f"Citations have been written into {os.path.abspath(output_file_path)}") diff --git a/src/sorcha_cmdline/main.py b/src/sorcha_cmdline/main.py index 383dc51b..f8d821c5 100644 --- a/src/sorcha_cmdline/main.py +++ b/src/sorcha_cmdline/main.py @@ -37,6 +37,7 @@ def main(): " outputs Manipulate/package sorcha outputs\n" " demo Set up a demo simulation\n" " bootstrap Download datafiles required to run sorcha\n" + " cite Outputs the citation to a file\n" "\n" "To get more information, run the verb with --help. For example:\n\n" " sorcha run --help\n" From 853eec13b12657323cf904dc0995730b1d4efe49 Mon Sep 17 00:00:00 2001 From: Ryan Lyttle Date: Tue, 14 Jan 2025 14:16:53 +0000 Subject: [PATCH 2/6] Changed the cite command and it's docs Changed the function cite_sorcha() print statements to f.write and set the default to be sys.stdout. Made some formatting changes to the citation text to make it more readable when outputted in the text file. Updated the docs to include this method of getting the citation information --- docs/cite.rst | 8 +- src/sorcha/utilities/citation_text.py | 1214 +++++++++++++------------ src/sorcha_cmdline/cite.py | 27 +- 3 files changed, 638 insertions(+), 611 deletions(-) diff --git a/docs/cite.rst b/docs/cite.rst index cbcdca86..05210ecc 100644 --- a/docs/cite.rst +++ b/docs/cite.rst @@ -3,7 +3,13 @@ Citing the Software Built-In Citation Function ---------------------------- -If you use Sorcha in your research, please do include a citation in your published papers for sorcha and the software packages and resources that sorcha is based on. The simplest way to find this information is to use our built-in citation function. In an interactive Python session or a Jupyter notebook:: +If you use Sorcha in your research, please do include a citation in your published papers for sorcha and the software packages and resources that sorcha is based on. There are two ways to find this information: + +The first is to create a text file of the citation by running the following command on the command line:: + + sorcha cite + +The second is to use our built-in citation function. In an interactive Python session or a Jupyter notebook:: import sorcha sorcha.cite() diff --git a/src/sorcha/utilities/citation_text.py b/src/sorcha/utilities/citation_text.py index 12750638..da4d4e59 100644 --- a/src/sorcha/utilities/citation_text.py +++ b/src/sorcha/utilities/citation_text.py @@ -1,361 +1,364 @@ import rebound +import sys -def cite_sorcha(): +def cite_sorcha(f=sys.stdout): """Providing the bibtex, AAS Journals software latex command, and acknowledgement statements for Sorcha and the associated packages that power it. Parameters ----------- - None + f: file-like object + The output for where the citation information will be written. Default: sys.stdout Returns ----------- None """ - print("\nSorcha: \n") - print("Merritt et al. (in prep)") - print("\n") + f.write("\nSorcha: \n\n") + f.write("Merritt et al. (submitted)\n\n") + f.write("Holman et al. (submitted)\n") + f.write("\n\n") - print("Please also cite the packages that are utilized by Sorcha:") + f.write("Please also cite the packages that are utilized by Sorcha:\n") - print("\nASSIST:\n") + f.write("\nASSIST:\n\n") - print("@ARTICLE{2023PSJ.....4...69H,") - print( + f.write("@ARTICLE{2023PSJ.....4...69H,\n") + f.write( "author = {{Holman}, Matthew J. and {Akmal}, Arya and {Farnocchia}," " Davide and {Rein}, Hanno and {Payne}, Matthew J. and {Weryk}, Robert" - " and {Tamayo}, Daniel and {Hernandez}, David M.}," + " and {Tamayo}, Daniel and {Hernandez}, David M.},\n" ) - print('title = "{ASSIST: An Ephemeris-quality Test-particle Integrator}",') - print("journal = {\\psj},") - print( + f.write('title = "{ASSIST: An Ephemeris-quality Test-particle Integrator}",\n') + f.write("journal = {\\psj},\n") + f.write( "keywords = {Ephemerides, N-body simulations, Asteroid dynamics, " "Comet dynamics, 464, 1083, 2210, 2213, Astrophysics - Earth and Planetary Astrophysics," - "Astrophysics - Instrumentation and Methods for Astrophysics}," - ) - print("year = 2023,") - print("month = apr,") - print("volume = {4},") - print("number = {4},") - print("eid = {69},") - print("pages = {69},") - print("doi = {10.3847/PSJ/acc9a9},") - print("archivePrefix = {arXiv},") - print("eprint = {2303.16246},") - print("primaryClass = {astro-ph.EP},") - print("adsurl = {https://ui.adsabs.harvard.edu/abs/2023PSJ.....4...69H},") - print("adsnote = {Provided by the SAO/NASA Astrophysics Data System}") - print("}") - - print("\n") - - print("@software{hanno_rein_2023_7778017,") - print("author = {Hanno Rein and matthewholman and Arya Akmal},") - print("title = {matthewholman/assist: v1.1.1},") - print("month = mar,") - print("year = 2023,") - print("publisher = {Zenodo},") - print("version = {v1.1.1},") - print("doi = {10.5281/zenodo.7778017},") - print("url = {https://doi.org/10.5281/zenodo.7778017}") - print("}") - - print("\nAstropy:\n") - print("@ARTICLE{2013A&A...558A..33A,") - print( - " author = {{Astropy Collaboration} and {Robitaille}, Thomas P. " - "and {Tollerud}, Erik J. and {Greenfield}, Perry and {Droettboom}, " - " Michael and {Bray}, Erik and {Aldcroft}, Tom and {Davis}, Matt " - "and {Ginsburg}, Adam and {Price-Whelan}, Adrian M. and {Kerzendorf}, " - " Wolfgang E. and {Conley}, Alexander and {Crighton}, Neil and " - "{Barbary}, Kyle and {Muna}, Demitri and {Ferguson}, Henry " - " and {Grollier}, Fr{\\'e}d{\\'e}ric and {Parikh}, Madhura M. " - "and {Nair}, Prasanth H. and {Unther}, Hans M. and {Deil}, Christoph " - " and {Woillez}, Julien and {Conseil}, Simon and {Kramer}, Roban " - "and {Turner}, James E.~H. and {Singer}, Leo and {Fox}, Ryan and " - "{Weaver}, Benjamin A. and {Zabalza}, Victor and {Edwards}, " - "Zachary I. and {Azalee Bostroem}, K. and {Burke}, D.~J. and {Casey}, " - "Andrew R. and {Crawford}, Steven M. and {Dencheva}, Nadia and {Ely}," - "Justin and {Jenness}, Tim and {Labrie}, Kathleen and {Lim}, Pey Lian and " - "{Pierfederici}, Francesco and {Pontzen}, Andrew and {Ptak}, Andy " - " and {Refsdal}, Brian and {Servillat}, Mathieu and {Streicher}, Ole}," - ) - print('title = "{Astropy: A community Python package for astronomy}",') - print("journal = {\\aap},") - print( + "Astrophysics - Instrumentation and Methods for Astrophysics},\n" + ) + f.write("year = 2023,\n") + f.write("month = apr,\n") + f.write("volume = {4},\n") + f.write("number = {4},\n") + f.write("eid = {69},\n") + f.write("pages = {69},\n") + f.write("doi = {10.3847/PSJ/acc9a9},\n") + f.write("archivePrefix = {arXiv},\n") + f.write("eprint = {2303.16246},\n") + f.write("primaryClass = {astro-ph.EP},\n") + f.write("adsurl = {https://ui.adsabs.harvard.edu/abs/2023PSJ.....4...69H},\n") + f.write("adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n") + f.write("}\n") + + f.write("\n\n") + + f.write("@software{hanno_rein_2023_7778017,\n") + f.write("author = {Hanno Rein and matthewholman and Arya Akmal},\n") + f.write("title = {matthewholman/assist: v1.1.1},\n") + f.write("month = mar,\n") + f.write("year = 2023,\n") + f.write("publisher = {Zenodo},\n") + f.write("version = {v1.1.1},\n") + f.write("doi = {10.5281/zenodo.7778017},\n") + f.write("url = {https://doi.org/10.5281/zenodo.7778017}\n") + f.write("}\n") + + f.write("\nAstropy:\n\n") + f.write("@ARTICLE{2013A&A...558A..33A,\n") + f.write( + "author = {{Astropy Collaboration} and {Robitaille}, Thomas P. \n" + "and {Tollerud}, Erik J. and {Greenfield}, Perry and {Droettboom}, \n" + " Michael and {Bray}, Erik and {Aldcroft}, Tom and {Davis}, Matt \n" + "and {Ginsburg}, Adam and {Price-Whelan}, Adrian M. and {Kerzendorf}, \n" + " Wolfgang E. and {Conley}, Alexander and {Crighton}, Neil and \n" + "{Barbary}, Kyle and {Muna}, Demitri and {Ferguson}, Henry \n" + " and {Grollier}, Fr{\\'e}d{\\'e}ric and {Parikh}, Madhura M. \n" + "and {Nair}, Prasanth H. and {Unther}, Hans M. and {Deil}, Christoph \n" + " and {Woillez}, Julien and {Conseil}, Simon and {Kramer}, Roban \n" + "and {Turner}, James E.~H. and {Singer}, Leo and {Fox}, Ryan and \n" + "{Weaver}, Benjamin A. and {Zabalza}, Victor and {Edwards}, \n" + "Zachary I. and {Azalee Bostroem}, K. and {Burke}, D.~J. and {Casey}, \n" + "Andrew R. and {Crawford}, Steven M. and {Dencheva}, Nadia and {Ely},\n" + "Justin and {Jenness}, Tim and {Labrie}, Kathleen and {Lim}, Pey Lian and \n" + "{Pierfederici}, Francesco and {Pontzen}, Andrew and {Ptak}, Andy \n" + " and {Refsdal}, Brian and {Servillat}, Mathieu and {Streicher}, Ole},\n" + ) + f.write('title = "{Astropy: A community Python package for astronomy}",\n') + f.write("journal = {\\aap},\n") + f.write( "keywords = {methods: data analysis, methods: miscellaneous, " "virtual observatory tools, Astrophysics - Instrumentation and " - "Methods for Astrophysics}," - ) - print("year = 2013,") - print("month = oct,") - print("volume = {558},") - print("eid = {A33},") - print("pages = {A33},") - print("doi = {10.1051/0004-6361/201322068},") - print("archivePrefix = {arXiv},") - print("eprint = {1307.6212},") - print("primaryClass = {astro-ph.IM},") - print("adsurl = {https://ui.adsabs.harvard.edu/abs/2013A&A...558A..33A},") - print("adsnote = {Provided by the SAO/NASA Astrophysics Data System}") - print("}") - - print("\n") - print("@ARTICLE{2018AJ....156..123A,") - print( - "author = {{Astropy Collaboration} and {Price-Whelan}, A.~M. " - 'and {Sip{\\H{o}}cz}, B.~M. and {G{\\"u}nther}, H.~M. and {Lim}, P.~L. ' - "and {Crawford}, S.~M. and {Conseil}, S. and {Shupe}, D.~L. and " - "{Craig}, M.~W. and {Dencheva}, N. and {Ginsburg}, A. and " - "{VanderPlas}, J.~T. and {Bradley}, L.~D. and {P{'e}rez-Su{'a}rez}, D. " - "and {de Val-Borro}, M. and {Aldcroft}, T.~L. and {Cruz}, K.~L. and " - "{Robitaille}, T.~P. and {Tollerud}, E.~J. and {Ardelean}, C. and " - "{Babej}, T. and {Bach}, Y.~P. and {Bachetti}, M. and {Bakanov}, " - "A.~V. and {Bamford}, S.~P. and {Barentsen}, G. and {Barmby}, " - " P. and {Baumbach}, A. and {Berry}, K.~L. and {Biscani}, F. and {Boquien}, " - "M. and {Bostroem}, K.~A. and {Bouma}, L.~G. and {Brammer}, G.~B. and " - " {Bray}, E.~M. and {Breytenbach}, H. and {Buddelmeijer}, H. and " - "{Burke}, D.~J. and {Calderone}, G. and {Cano Rodr{\\'\\i}guez}, J.~L. " - "and {Cara}, M. and {Cardoso}, J.~V.~M. and {Cheedella}, S. and {Copin}, " - "Y. and {Corrales}, L. and {Crichton}, D. and {D'Avella}, D. and {Deil}, " - "C. and {Depagne}, {'E}. and {Dietrich}, J.~P. and {Donath}, A. and " - "{Droettboom}, M. and {Earl}, N. and {Erben}, T. and {Fabbro}, S. and " - "{Ferreira}, L.~A. and {Finethy}, T. and {Fox}, R.~T. and {Garrison}, " - "L.~H. and {Gibbons}, S.~L.~J. and {Goldstein}, D.~A. and {Gommers}, R. " - "and {Greco}, J.~P. and {Greenfield}, P. and {Groener}, A.~M. and " - "{Grollier}, F. and {Hagen}, A. and {Hirst}, P. and {Homeier}, D. " - "and {Horton}, A.~J. and {Hosseinzadeh}, G. and {Hu}, L. and {Hunkeler}, " - "J.~S. and {Ivezi{\\'c}}, {\\v{Z}}. and {Jain}, A. and {Jenness}, T. " - "and {Kanarek}, G. and {Kendrew}, S. and {Kern}, N.~S. and {Kerzendorf}, " - "W.~E. and {Khvalko}, A. and {King}, J. and {Kirkby}, D. and {Kulkarni}, " - "A.~M. and {Kumar}, A. and {Lee}, A. and {Lenz}, D. and {Littlefair}, " - "S.~P. and {Ma}, Z. and {Macleod}, D.~M. and {Mastropietro}, M. and " - "{McCully}, C. and {Montagnac}, S. and {Morris}, B.~M. and {Mueller}, M. " - " and {Mumford}, S.~J. and {Muna}, D. and {Murphy}, N.~A. and {Nelson}, S. " - ' and {Nguyen}, G.~H. and {Ninan}, J.~P. and {N{"o}the}, M. and {Ogaz}, S. ' - "and {Oh}, S. and {Parejko}, J.~K. and {Parley}, N. and {Pascual}, S. and " - "{Patil}, R. and {Patil}, A.~A. and {Plunkett}, A.~L. and {Prochaska}, J.~X. " - "and {Rastogi}, T. and {Reddy Janga}, V. and {Sabater}, J. and {Sakurikar}, " - "P. and {Seifert}, M. and {Sherbert}, L.~E. and {Sherwood-Taylor}, H. " - " and {Shih}, A.~Y. and {Sick}, J. and {Silbiger}, M.~T. and " - "{Singanamalla}, S. and {Singer}, L.~P. and {Sladen}, P.~H. and {Sooley}, " - "K.~A. and {Sornarajah}, S. and {Streicher}, O. and {Teuben}, P. and " - "{Thomas}, S.~W. and {Tremblay}, G.~R. and {Turner}, J.~E.~H. and " - "{Terr{\\'o}n}, V. and {van Kerkwijk}, M.~H. and {de la Vega}, A. and " - "{Watkins}, L.~L. and {Weaver}, B.~A. and {Whitmore}, J.~B. and {Woillez}, " - "J. and {Zabalza}, V. and {Astropy Contributors}}," - ) - print( + "Methods for Astrophysics},\n" + ) + f.write("year = 2013,\n") + f.write("month = oct,\n") + f.write("volume = {558},\n") + f.write("eid = {A33},\n") + f.write("pages = {A33},\n") + f.write("doi = {10.1051/0004-6361/201322068},\n") + f.write("archivePrefix = {arXiv},\n") + f.write("eprint = {1307.6212},\n") + f.write("primaryClass = {astro-ph.IM},\n") + f.write("adsurl = {https://ui.adsabs.harvard.edu/abs/2013A&A...558A..33A},\n") + f.write("adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n") + f.write("}\n") + + f.write("\n\n") + f.write("@ARTICLE{2018AJ....156..123A,\n") + f.write( + "author = {{Astropy Collaboration} and {Price-Whelan}, A.~M. \n" + 'and {Sip{\\H{o}}cz}, B.~M. and {G{\\"u}nther}, H.~M. and {Lim}, P.~L. \n' + "and {Crawford}, S.~M. and {Conseil}, S. and {Shupe}, D.~L. and \n" + "{Craig}, M.~W. and {Dencheva}, N. and {Ginsburg}, A. and \n" + "{VanderPlas}, J.~T. and {Bradley}, L.~D. and {P{'e}rez-Su{'a}rez}, D. \n" + "and {de Val-Borro}, M. and {Aldcroft}, T.~L. and {Cruz}, K.~L. and \n" + "{Robitaille}, T.~P. and {Tollerud}, E.~J. and {Ardelean}, C. and \n" + "{Babej}, T. and {Bach}, Y.~P. and {Bachetti}, M. and {Bakanov}, \n" + "A.~V. and {Bamford}, S.~P. and {Barentsen}, G. and {Barmby}, \n" + " P. and {Baumbach}, A. and {Berry}, K.~L. and {Biscani}, F. and {Boquien}, \n" + "M. and {Bostroem}, K.~A. and {Bouma}, L.~G. and {Brammer}, G.~B. and \n" + " {Bray}, E.~M. and {Breytenbach}, H. and {Buddelmeijer}, H. and \n" + "{Burke}, D.~J. and {Calderone}, G. and {Cano Rodr{\\'\\i}guez}, J.~L. \n" + "and {Cara}, M. and {Cardoso}, J.~V.~M. and {Cheedella}, S. and {Copin}, \n" + "Y. and {Corrales}, L. and {Crichton}, D. and {D'Avella}, D. and {Deil}, \n" + "C. and {Depagne}, {'E}. and {Dietrich}, J.~P. and {Donath}, A. and \n" + "{Droettboom}, M. and {Earl}, N. and {Erben}, T. and {Fabbro}, S. and \n" + "{Ferreira}, L.~A. and {Finethy}, T. and {Fox}, R.~T. and {Garrison}, \n" + "L.~H. and {Gibbons}, S.~L.~J. and {Goldstein}, D.~A. and {Gommers}, R. \n" + "and {Greco}, J.~P. and {Greenfield}, P. and {Groener}, A.~M. and \n" + "{Grollier}, F. and {Hagen}, A. and {Hirst}, P. and {Homeier}, D. \n" + "and {Horton}, A.~J. and {Hosseinzadeh}, G. and {Hu}, L. and {Hunkeler}, \n" + "J.~S. and {Ivezi{\\'c}}, {\\v{Z}}. and {Jain}, A. and {Jenness}, T. \n" + "and {Kanarek}, G. and {Kendrew}, S. and {Kern}, N.~S. and {Kerzendorf}, \n" + "W.~E. and {Khvalko}, A. and {King}, J. and {Kirkby}, D. and {Kulkarni}, \n" + "A.~M. and {Kumar}, A. and {Lee}, A. and {Lenz}, D. and {Littlefair}, \n" + "S.~P. and {Ma}, Z. and {Macleod}, D.~M. and {Mastropietro}, M. and \n" + "{McCully}, C. and {Montagnac}, S. and {Morris}, B.~M. and {Mueller}, M. \n" + " and {Mumford}, S.~J. and {Muna}, D. and {Murphy}, N.~A. and {Nelson}, S. \n" + ' and {Nguyen}, G.~H. and {Ninan}, J.~P. and {N{"o}the}, M. and {Ogaz}, S. \n' + "and {Oh}, S. and {Parejko}, J.~K. and {Parley}, N. and {Pascual}, S. and \n" + "{Patil}, R. and {Patil}, A.~A. and {Plunkett}, A.~L. and {Prochaska}, J.~X. \n" + "and {Rastogi}, T. and {Reddy Janga}, V. and {Sabater}, J. and {Sakurikar}, \n" + "P. and {Seifert}, M. and {Sherbert}, L.~E. and {Sherwood-Taylor}, H. \n" + " and {Shih}, A.~Y. and {Sick}, J. and {Silbiger}, M.~T. and \n" + "{Singanamalla}, S. and {Singer}, L.~P. and {Sladen}, P.~H. and {Sooley}, \n" + "K.~A. and {Sornarajah}, S. and {Streicher}, O. and {Teuben}, P. and \n" + "{Thomas}, S.~W. and {Tremblay}, G.~R. and {Turner}, J.~E.~H. and \n" + "{Terr{\\'o}n}, V. and {van Kerkwijk}, M.~H. and {de la Vega}, A. and \n" + "{Watkins}, L.~L. and {Weaver}, B.~A. and {Whitmore}, J.~B. and {Woillez}, \n" + "J. and {Zabalza}, V. and {Astropy Contributors}},\n" + ) + f.write( 'title = "{The Astropy Project: Building an Open-science Project ' - 'and Status of the v2.0 Core Package}",' + 'and Status of the v2.0 Core Package}",\n' ) - print("journal = {\\aj},") - print( + f.write("journal = {\\aj},\n") + f.write( "keywords = {methods: data analysis, methods: miscellaneous, " "methods: statistical, reference systems, Astrophysics - " - "Instrumentation and Methods for Astrophysics}," - ) - print("year = 2018,") - print("month = sep,") - print("volume = {156},") - print("number = {3},") - print("eid = {123},") - print("pages = {123},") - print("doi = {10.3847/1538-3881/aabc4f},") - print("archivePrefix = {arXiv},") - print("eprint = {1801.02634},") - print("primaryClass = {astro-ph.IM},") - print("adsurl = {https://ui.adsabs.harvard.edu/abs/2018AJ....156..123A},") - print("adsnote = {Provided by the SAO/NASA Astrophysics Data System}") - print("}") - - print("\n") - print("@ARTICLE{2022ApJ...935..167A,") - print( - "author = {{Astropy Collaboration} and {Price-Whelan}, Adrian M. and " - "{Lim}, Pey Lian and {Earl}, Nicholas and {Starkman}, Nathaniel and {Bradley}, " - "Larry and {Shupe}, David L. and {Patil}, Aarya A. and {Corrales}, Lia and " - '{Brasseur}, C.~E. and {N{\\"o}the}, Maximilian and {Donath}, Axel and ' - "{Tollerud}, Erik and {Morris}, Brett M. and {Ginsburg}, Adam and {Vaher}, " - "Eero and {Weaver}, Benjamin A. and {Tocknell}, James and {Jamieson}, William " - "and {van Kerkwijk}, Marten H. and {Robitaille}, Thomas P. and {Merry}, Bruce " - 'and {Bachetti}, Matteo and {G{\\"u}nther}, H. Moritz and {Aldcroft}, Thomas L. ' - "and {Alvarado-Montes}, Jaime A. and {Archibald}, Anne M. and {B{'o}di}, " - "Attila and {Bapat}, Shreyas and {Barentsen}, Geert and {Baz{'a}n}, Juanjo " - "and {Biswas}, Manish and {Boquien}, M{\\'e}d{\\'e}ric and {Burke}, D.~J. and " - "{Cara}, Daria and {Cara}, Mihai and {Conroy}, Kyle E. and {Conseil}, Simon and " - "{Craig}, Matthew W. and {Cross}, Robert M. and {Cruz}, Kelle L. and {D'Eugenio}, " - 'Francesco and {Dencheva}, Nadia and {Devillepoix}, Hadrien A.~R. and {Dietrich}, J{\\"o}rg P. ' - "and {Eigenbrot}, Arthur Davis and {Erben}, Thomas and {Ferreira}, Leonardo and " - "{Foreman-Mackey}, Daniel and {Fox}, Ryan and {Freij}, Nabil and {Garg}, Suyog and {Geda}, " - "Robel and {Glattly}, Lauren and {Gondhalekar}, Yash and {Gordon}, Karl D. and {Grant}, David " - "and {Greenfield}, Perry and {Groener}, Austen M. and {Guest}, Steve and {Gurovich}, Sebastian " - "and {Handberg}, Rasmus and {Hart}, Akeem and {Hatfield-Dodds}, Zac and {Homeier}, Derek and " - "{Hosseinzadeh}, Griffin and {Jenness}, Tim and {Jones}, Craig K. and {Joseph}, Prajwel and " - "{Kalmbach}, J. Bryce and {Karamehmetoglu}, Emir and {Ka{\\l}uszy{'n}ski}, Miko{\\l}aj and {Kelley}, " - "Michael S.~P. and {Kern}, Nicholas and {Kerzendorf}, Wolfgang E. and {Koch}, Eric W. and " - "{Kulumani}, Shankar and {Lee}, Antony and {Ly}, Chun and {Ma}, Zhiyuan and {MacBride}, Conor " - "and {Maljaars}, Jakob M. and {Muna}, Demitri and {Murphy}, N.~A. and {Norman}, Henrik and {O'Steen}, Richard " - "and {Oman}, Kyle A. and {Pacifici}, Camilla and {Pascual}, Sergio and {Pascual-Granado}, J. and " - "{Patil}, Rohit R. and {Perren}, Gabriel I. and {Pickering}, Timothy E. and {Rastogi}, Tanuj and " - "{Roulston}, Benjamin R. and {Ryan}, Daniel F. and {Rykoff}, Eli S. and {Sabater}, Jose and {Sakurikar}, " - "Parikshit and {Salgado}, Jes{\\'u}s and {Sanghi}, Aniket and {Saunders}, Nicholas and {Savchenko}, " - "Volodymyr and {Schwardt}, Ludwig and {Seifert-Eckert}, Michael and {Shih}, Albert Y. and {Jain}, " - "Anany Shrey and {Shukla}, Gyanendra and {Sick}, Jonathan and {Simpson}, Chris and {Singanamalla}, " - "Sudheesh and {Singer}, Leo P. and {Singhal}, Jaladh and {Sinha}, Manodeep and {Sip{\\H{o}}cz}, " - "Brigitta M. and {Spitler}, Lee R. and {Stansby}, David and {Streicher}, Ole and {{\\v{S}}umak}, " - "Jani and {Swinbank}, John D. and {Taranu}, Dan S. and {Tewary}, Nikita and {Tremblay}, Grant R. " - "and {de Val-Borro}, Miguel and {Van Kooten}, Samuel J. and {Vasovi{\\'c}}, Zlatan and {Verma}, Shresth " - "and {de Miranda Cardoso}, Jos{\\'e} Vin{\\'\\i}cius and {Williams}, Peter K.~G. and " - "{Wilson}, Tom J. and {Winkel}, Benjamin and {Wood-Vasey}, W.~M. and {Xue}, " - "Rui and {Yoachim}, Peter and {Zhang}, Chen and {Zonca}, Andrea and {Astropy Project Contributors}}," - ) - print( + "Instrumentation and Methods for Astrophysics},\n" + ) + f.write("year = 2018,\n") + f.write("month = sep,\n") + f.write("volume = {156},\n") + f.write("number = {3},\n") + f.write("eid = {123},\n") + f.write("pages = {123},\n") + f.write("doi = {10.3847/1538-3881/aabc4f},\n") + f.write("archivePrefix = {arXiv},\n") + f.write("eprint = {1801.02634},\n") + f.write("primaryClass = {astro-ph.IM},\n") + f.write("adsurl = {https://ui.adsabs.harvard.edu/abs/2018AJ....156..123A},\n") + f.write("adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n") + f.write("}\n") + + f.write("\n\n") + f.write("@ARTICLE{2022ApJ...935..167A,\n") + f.write( + "author = {{Astropy Collaboration} and {Price-Whelan}, Adrian M. and \n" + "{Lim}, Pey Lian and {Earl}, Nicholas and {Starkman}, Nathaniel and {Bradley}, \n" + "Larry and {Shupe}, David L. and {Patil}, Aarya A. and {Corrales}, Lia and \n" + '{Brasseur}, C.~E. and {N{\\"o}the}, Maximilian and {Donath}, Axel and \n' + "{Tollerud}, Erik and {Morris}, Brett M. and {Ginsburg}, Adam and {Vaher}, \n" + "Eero and {Weaver}, Benjamin A. and {Tocknell}, James and {Jamieson}, William \n" + "and {van Kerkwijk}, Marten H. and {Robitaille}, Thomas P. and {Merry}, Bruce \n" + 'and {Bachetti}, Matteo and {G{\\"u}nther}, H. Moritz and {Aldcroft}, Thomas L. \n' + "and {Alvarado-Montes}, Jaime A. and {Archibald}, Anne M. and {B{'o}di}, \n" + "Attila and {Bapat}, Shreyas and {Barentsen}, Geert and {Baz{'a}n}, Juanjo \n" + "and {Biswas}, Manish and {Boquien}, M{\\'e}d{\\'e}ric and {Burke}, D.~J. and \n" + "{Cara}, Daria and {Cara}, Mihai and {Conroy}, Kyle E. and {Conseil}, Simon and \n" + "{Craig}, Matthew W. and {Cross}, Robert M. and {Cruz}, Kelle L. and {D'Eugenio}, \n" + 'Francesco and {Dencheva}, Nadia and {Devillepoix}, Hadrien A.~R. and {Dietrich}, J{\\"o}rg P. \n' + "and {Eigenbrot}, Arthur Davis and {Erben}, Thomas and {Ferreira}, Leonardo and \n" + "{Foreman-Mackey}, Daniel and {Fox}, Ryan and {Freij}, Nabil and {Garg}, Suyog and {Geda}, \n" + "Robel and {Glattly}, Lauren and {Gondhalekar}, Yash and {Gordon}, Karl D. and {Grant}, David \n" + "and {Greenfield}, Perry and {Groener}, Austen M. and {Guest}, Steve and {Gurovich}, Sebastian \n" + "and {Handberg}, Rasmus and {Hart}, Akeem and {Hatfield-Dodds}, Zac and {Homeier}, Derek and \n" + "{Hosseinzadeh}, Griffin and {Jenness}, Tim and {Jones}, Craig K. and {Joseph}, Prajwel and \n" + "{Kalmbach}, J. Bryce and {Karamehmetoglu}, Emir and {Ka{\\l}uszy{'n}ski}, Miko{\\l}aj and {Kelley}, \n" + "Michael S.~P. and {Kern}, Nicholas and {Kerzendorf}, Wolfgang E. and {Koch}, Eric W. and \n" + "{Kulumani}, Shankar and {Lee}, Antony and {Ly}, Chun and {Ma}, Zhiyuan and {MacBride}, Conor \n" + "and {Maljaars}, Jakob M. and {Muna}, Demitri and {Murphy}, N.~A. and {Norman}, Henrik and {O'Steen}, Richard \n" + "and {Oman}, Kyle A. and {Pacifici}, Camilla and {Pascual}, Sergio and {Pascual-Granado}, J. and \n" + "{Patil}, Rohit R. and {Perren}, Gabriel I. and {Pickering}, Timothy E. and {Rastogi}, Tanuj and \n" + "{Roulston}, Benjamin R. and {Ryan}, Daniel F. and {Rykoff}, Eli S. and {Sabater}, Jose and {Sakurikar}, \n" + "Parikshit and {Salgado}, Jes{\\'u}s and {Sanghi}, Aniket and {Saunders}, Nicholas and {Savchenko}, \n" + "Volodymyr and {Schwardt}, Ludwig and {Seifert-Eckert}, Michael and {Shih}, Albert Y. and {Jain}, \n" + "Anany Shrey and {Shukla}, Gyanendra and {Sick}, Jonathan and {Simpson}, Chris and {Singanamalla}, \n" + "Sudheesh and {Singer}, Leo P. and {Singhal}, Jaladh and {Sinha}, Manodeep and {Sip{\\H{o}}cz}, \n" + "Brigitta M. and {Spitler}, Lee R. and {Stansby}, David and {Streicher}, Ole and {{\\v{S}}umak}, \n" + "Jani and {Swinbank}, John D. and {Taranu}, Dan S. and {Tewary}, Nikita and {Tremblay}, Grant R. \n" + "and {de Val-Borro}, Miguel and {Van Kooten}, Samuel J. and {Vasovi{\\'c}}, Zlatan and {Verma}, Shresth \n" + "and {de Miranda Cardoso}, Jos{\\'e} Vin{\\'\\i}cius and {Williams}, Peter K.~G. and \n" + "{Wilson}, Tom J. and {Winkel}, Benjamin and {Wood-Vasey}, W.~M. and {Xue}, \n" + "Rui and {Yoachim}, Peter and {Zhang}, Chen and {Zonca}, Andrea and {Astropy Project Contributors}},\n" + ) + f.write( 'title = "{The Astropy Project: Sustaining and Growing a Community-oriented ' - 'Open-source Project and the Latest Major Release (v5.0) of the Core Package}", ' + 'Open-source Project and the Latest Major Release (v5.0) of the Core Package}", \n' ) - print("journal = {\\apj},") - print( + f.write("journal = {\\apj},\n") + f.write( "keywords = {Astronomy software, Open source software, Astronomy " "data analysis, 1855, 1866, 1858, Astrophysics - Instrumentation and " - "Methods for Astrophysics}," - ) - print("year = 2022,") - print("month = aug,") - print("volume = {935},") - print("number = {2},") - print("eid = {167},") - print("pages = {167},") - print("doi = {10.3847/1538-4357/ac7c74},") - print("archivePrefix = {arXiv},") - print("eprint = {2206.14220},") - print("primaryClass = {astro-ph.IM},") - print("adsurl = {https://ui.adsabs.harvard.edu/abs/2022ApJ...935..167A},") - print("adsnote = {Provided by the SAO/NASA Astrophysics Data System}") - print("}") - - print("\nHealpy:\n") - print("@article{Zonca2019,") - print("doi = {10.21105/joss.01298},") - print("url = {https://doi.org/10.21105/joss.01298},") - print("year = {2019},") - print("month = mar,") - print("publisher = {The Open Journal},") - print("volume = {4},") - print("number = {35},") - print("pages = {1298},") - print( + "Methods for Astrophysics},\n" + ) + f.write("year = 2022,\n") + f.write("month = aug,\n") + f.write("volume = {935},\n") + f.write("number = {2},\n") + f.write("eid = {167},\n") + f.write("pages = {167},\n") + f.write("doi = {10.3847/1538-4357/ac7c74},\n") + f.write("archivePrefix = {arXiv},\n") + f.write("eprint = {2206.14220},\n") + f.write("primaryClass = {astro-ph.IM},\n") + f.write("adsurl = {https://ui.adsabs.harvard.edu/abs/2022ApJ...935..167A},\n") + f.write("adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n") + f.write("}\n") + + f.write("\nHealpy:\n\n") + f.write("@article{Zonca2019,\n") + f.write("doi = {10.21105/joss.01298},\n") + f.write("url = {https://doi.org/10.21105/joss.01298},\n") + f.write("year = {2019},\n") + f.write("month = mar,\n") + f.write("publisher = {The Open Journal},\n") + f.write("volume = {4},\n") + f.write("number = {35},\n") + f.write("pages = {1298},\n") + f.write( "author = {Andrea Zonca and Leo Singer and Daniel Lenz and Martin Reinecke " - "and Cyrille Rosset and Eric Hivon and Krzysztof Gorski}," + "and Cyrille Rosset and Eric Hivon and Krzysztof Gorski},\n" ) - print( - "title = {healpy: equal area pixelization and spherical harmonics transforms for data on the sphere in Python}," + f.write( + "title = {healpy: equal area pixelization and spherical harmonics transforms for data on the sphere in Python},\n" ) - print("journal = {Journal of Open Source Software}") - print("}") + f.write("journal = {Journal of Open Source Software}\n") + f.write("}\n") - print("\n") + f.write("\n\n") - print("@ARTICLE{2005ApJ...622..759G,") - print("author = {{G{'o}rski}, K.~M. and {Hivon}, E. and {Banday}, A.~J. and ") - print("{Wandelt}, B.~D. and {Hansen}, F.~K. and {Reinecke}, M. and ") - print("{Bartelmann}, M.},") - print( + f.write("@ARTICLE{2005ApJ...622..759G,\n") + f.write("author = {{G{'o}rski}, K.~M. and {Hivon}, E. and {Banday}, A.~J. and \n") + f.write("{Wandelt}, B.~D. and {Hansen}, F.~K. and {Reinecke}, M. and \n") + f.write("{Bartelmann}, M.},\n") + f.write( 'title = "{HEALPix: A Framework for High-Resolution Discretization ' - 'and Fast Analysis of Data Distributed on the Sphere}",' + 'and Fast Analysis of Data Distributed on the Sphere}",\n' ) - print("journal = {\\apj},") - print("eprint = {arXiv:astro-ph/0409513},") - print( - "keywords = {Cosmology: Cosmic Microwave Background, Cosmology: Observations, Methods: Statistical}," + f.write("journal = {\\apj},\n") + f.write("eprint = {arXiv:astro-ph/0409513},\n") + f.write( + "keywords = {Cosmology: Cosmic Microwave Background, Cosmology: Observations, Methods: Statistical},\n" ) - print("year = 2005,") - print("month = apr,") - print("volume = 622,") - print("pages = {759-771},") - print("doi = {10.1086/427976},") - print("adsurl = {http://adsabs.harvard.edu/abs/2005ApJ...622..759G},") - print("adsnote = {Provided by the SAO/NASA Astrophysics Data System}") - print("}") - - print("\n") - - print( + f.write("year = 2005,\n") + f.write("month = apr,\n") + f.write("volume = 622,\n") + f.write("pages = {759-771},\n") + f.write("doi = {10.1086/427976},\n") + f.write("adsurl = {http://adsabs.harvard.edu/abs/2005ApJ...622..759G},\n") + f.write("adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n") + f.write("}\n") + + f.write("\n\n") + + f.write( "Add an acknowledgment statement: “Some of the results in this " - "paper have been derived using the healpy and HEALPix packages”." + "paper have been derived using the healpy and HEALPix packages”.\n" ) - print("\n") + f.write("\n\n") - print( + f.write( "At the first use of the HEALPix acronym, a footnote placed in the" " main body of the paper referring to the HEALPix web site, " - "currently http://healpix.sf.net" + "currently http://healpix.sf.net \n" ) - print("\nJupyter Notebooks:\n") - print("@inproceedings{soton403913,") - print("booktitle = {Positioning and Power in Academic Publishing: Players, Agents and Agendas},") - print("title = {Jupyter Notebooks ? a publishing format for reproducible computational workflows},") - print( + f.write("\nJupyter Notebooks:\n\n") + f.write("@inproceedings{soton403913,\n") + f.write("booktitle = {Positioning and Power in Academic Publishing: Players, Agents and Agendas},\n") + f.write("title = {Jupyter Notebooks ? a publishing format for reproducible computational workflows},\n") + f.write( "author = {Thomas Kluyver and Benjamin Ragan-Kelley and Fernando P{\\'e}rez " "and Brian Granger and Matthias Bussonnier and Jonathan Frederic and Kyle Kelley " "and Jessica Hamrick and Jason Grout and Sylvain Corlay and Paul Ivanov " - "and Dami{\\'a}n Avila and Safia Abdalla and Carol Willing and Jupyter development team}," - ) - print("publisher = {IOS Press},") - print("year = {2016},") - print("pages = {87--90},") - print("url = {https://eprints.soton.ac.uk/403913/},") - print("}") - - print("\nmatplotlib:\n") - print("@Article{Hunter:2007,") - print(" Author = {Hunter, J. D.},") - print("Title = {Matplotlib: A 2D graphics environment},") - print("Journal = {Computing in Science \\& Engineering},") - print("Volume = {9},") - print("Number = {3},") - print("Pages = {90--95},") - print("abstract = {Matplotlib is a 2D graphics package used for Python for ") - print("application development, interactive scripting, and publication-quality ") - print("image generation across user interfaces and operating systems.},") - print("publisher = {IEEE COMPUTER SOC},") - print("doi = {10.1109/MCSE.2007.55},") - print("year = 2007") - print("}") - - print("\nMinor Planet Center Resources:\n") - - print( - "Add an acknowledgment statement: This research has made use of data and/or services provided by the International Astronomical Union's Minor Planet Center. " - ) - - print("\nNASA ADS:\n") - print( + "and Dami{\\'a}n Avila and Safia Abdalla and Carol Willing and Jupyter development team},\n" + ) + f.write("publisher = {IOS Press},\n") + f.write("year = {2016},\n") + f.write("pages = {87--90},\n") + f.write("url = {https://eprints.soton.ac.uk/403913/},\n") + f.write("}\n") + + f.write("\nmatplotlib:\n\n") + f.write("@Article{Hunter:2007,\n") + f.write("Author = {Hunter, J. D.},\n") + f.write("Title = {Matplotlib: A 2D graphics environment},\n") + f.write("Journal = {Computing in Science \\& Engineering},\n") + f.write("Volume = {9},\n") + f.write("Number = {3},\n") + f.write("Pages = {90--95},\n") + f.write("abstract = {Matplotlib is a 2D graphics package used for Python for \n") + f.write("application development, interactive scripting, and publication-quality \n") + f.write("image generation across user interfaces and operating systems.},\n") + f.write("publisher = {IEEE COMPUTER SOC},\n") + f.write("doi = {10.1109/MCSE.2007.55},\n") + f.write("year = 2007\n") + f.write("}\n") + + f.write("\nMinor Planet Center Resources:\n\n") + + f.write( + "Add an acknowledgment statement: This research has made use of data and/or services provided by the International Astronomical Union's Minor Planet Center. \n" + ) + + f.write("\nNASA ADS:\n\n") + f.write( "Add an acknowledgment statement: This research has made use of " - "NASA’s Astrophysics Data System Bibliographic Services. " - ) - - print("\nNumba:\n") - print("@INPROCEEDINGS{2015llvm.confE...1L,") - print("author = {{Lam}, Siu Kwan and {Pitrou}, Antoine and {Seibert}, Stanley},") - print('title = "{Numba: A LLVM-based Python JIT Compiler}",') - print("keywords = {LLVM, Python, Compiler},") - print("booktitle = {Proc. Second Workshop on the LLVM Compiler Infrastructure in HPC},") - print(" year = 2015,") - print("month = nov,") - print("pages = {1-6},") - print("doi = {10.1145/2833157.2833162},") - print("adsurl = {https://ui.adsabs.harvard.edu/abs/2015llvm.confE...1L},") - print("adsnote = {Provided by the SAO/NASA Astrophysics Data System}") - print("}") - - print("\nNumpy:\n") - print("@Article{ harris2020array,") - print("title = {Array programming with {NumPy}},") - print( + "NASA’s Astrophysics Data System Bibliographic Services. \n" + ) + + f.write("\nNumba:\n\n") + f.write("@INPROCEEDINGS{2015llvm.confE...1L,\n") + f.write("author = {{Lam}, Siu Kwan and {Pitrou}, Antoine and {Seibert}, Stanley},\n") + f.write('title = "{Numba: A LLVM-based Python JIT Compiler}",') + f.write("keywords = {LLVM, Python, Compiler},\n") + f.write("booktitle = {Proc. Second Workshop on the LLVM Compiler Infrastructure in HPC},\n") + f.write(" year = 2015,\n") + f.write("month = nov,\n") + f.write("pages = {1-6},\n") + f.write("doi = {10.1145/2833157.2833162},\n") + f.write("adsurl = {https://ui.adsabs.harvard.edu/abs/2015llvm.confE...1L},\n") + f.write("adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n") + f.write("}\n") + + f.write("\nNumpy:\n\n") + f.write("@Article{ harris2020array,\n") + f.write("title = {Array programming with {NumPy}},\n") + f.write( "author = {Charles R. Harris and K. Jarrod Millman " "and St{\\'{e}}fan J. van der Walt and Ralf Gommers and " "Pauli Virtanen and David Cournapeau and Eric Wieser and " @@ -365,321 +368,327 @@ def cite_sorcha(): "Fern{\\'{a}}ndez del R{\\'{i}}o and Mark Wiebe and " "Pearu Peterson and Pierre G{\\'{e}}rard-Marchant and Kevin " "Sheppard and Tyler Reddy and Warren Weckesser and Hameer Abbasi " - "and Christoph Gohlke and Travis E. Oliphant}," - ) - print("year = {2020},") - print("month = sep,") - print("journal = {Nature},") - print("volume = {585},") - print("number = {7825},") - print("pages = {357--362},") - print("doi = {10.1038/s41586-020-2649-2},") - print("publisher = {Springer Science and Business Media {LLC}},") - print("url = {https://doi.org/10.1038/s41586-020-2649-2}") - print("}") - - print("\nPandas:\n") - print("@InProceedings{ mckinney-proc-scipy-2010,") - print("author = { {W}es {M}c{K}inney },") - print("title = { {D}ata {S}tructures for {S}tatistical {C}omputing in {P}ython },") - print("booktitle = { {P}roceedings of the 9th {P}ython in {S}cience {C}onference },") - print("pages = { 56 - 61 },") - print("year = { 2010 },") - print("editor = { {S}t{\\'{e}}fan van der {W}alt and {J}arrod {M}illman },") - print("doi = { 10.25080/Majora-92bf1922-00a }") - print("}") - - print("\n") - print("Update to the exact version you have installed. Below is the generic Zenodo link reference. \n") - print("@software{reback2020pandas,") - print("author = {The pandas development team},") - print("title = {pandas-dev/pandas: Pandas},") - print("month = feb,") - print("year = 2020,") - print("publisher = {Zenodo},") - print("version = {latest},") - print("doi = {10.5281/zenodo.3509134},") - print("url = {https://doi.org/10.5281/zenodo.3509134}") - print("}") - - print("\nPooch:\n") - print("@article{uieda2020,") - print("title = {{Pooch}: {A} friend to fetch your data files},") - print( + "and Christoph Gohlke and Travis E. Oliphant},\n" + ) + f.write("year = {2020},\n") + f.write("month = sep,\n") + f.write("journal = {Nature},\n") + f.write("volume = {585},\n") + f.write("number = {7825},\n") + f.write("pages = {357--362},\n") + f.write("doi = {10.1038/s41586-020-2649-2},\n") + f.write("publisher = {Springer Science and Business Media {LLC}},\n") + f.write("url = {https://doi.org/10.1038/s41586-020-2649-2}\n") + f.write("}\n") + + f.write("\nPandas:\n\n") + f.write("@InProceedings{ mckinney-proc-scipy-2010,\n") + f.write("author = { {W}es {M}c{K}inney },\n") + f.write("title = { {D}ata {S}tructures for {S}tatistical {C}omputing in {P}ython },\n") + f.write("booktitle = { {P}roceedings of the 9th {P}ython in {S}cience {C}onference },\n") + f.write("pages = { 56 - 61 },\n") + f.write("year = { 2010 },\n") + f.write("editor = { {S}t{\\'{e}}fan van der {W}alt and {J}arrod {M}illman },\n") + f.write("doi = { 10.25080/Majora-92bf1922-00a }\n") + f.write("}\n") + + f.write("\n\n") + f.write( + "Update to the exact version you have installed. Below is the generic Zenodo link reference. \n\n" + ) + f.write("@software{reback2020pandas,\n") + f.write("author = {The pandas development team},\n") + f.write("title = {pandas-dev/pandas: Pandas},\n") + f.write("month = feb,\n") + f.write("year = 2020,\n") + f.write("publisher = {Zenodo},\n") + f.write("version = {latest},\n") + f.write("doi = {10.5281/zenodo.3509134},\n") + f.write("url = {https://doi.org/10.5281/zenodo.3509134}\n") + f.write("}\n") + + f.write("\nPooch:\n\n") + f.write("@article{uieda2020,\n") + f.write("title = {{Pooch}: {A} friend to fetch your data files},\n") + f.write( "author = {Leonardo Uieda and Santiago Soler and R{\\'{e}}mi Rampin " "and Hugo van Kemenade and Matthew Turk and Daniel Shapero and " - "Anderson Banihirwe and John Leeman}," - ) - print("year = {2020},") - print("doi = {10.21105/joss.01943},") - print("url = {https://doi.org/10.21105/joss.01943},") - print("month = jan,") - print("publisher = {The Open Journal},") - print("volume = {5},") - print(" number = {45},") - print("pages = {1943},") - print("journal = {Journal of Open Source Software}") - print("}") - - print("\nPytables\n") - print("@Misc{pytables,") - print("author = {PyTables Developers Team},") - print("title = {{PyTables}: Hierarchical Datasets in {Python}},") - print("year = {2002--},") - print('url = "https://www.pytables.org/",') - print("}") - - print("\nREBOUND:\n") - sim = rebound.Simulation() - sim.cite() - - print("\nAdapted Functions From rubin_sim:\n") - - print("@software{peter_yoachim_2022_7087823,") - print("author = {Peter Yoachim and") - print("R. Lynne Jones and") - print("Eric H. Neilsen and") - print("Tiago Ribeiro and") - print("Scott Daniel and") - print("Natasha Abrams and") - print("Husni Almoubayyed and") - print("Igor Andreoni and") - print("Humna Awan and") - print("Matthew R. Becker and") - print(" Keaton Bell and") - print("Eric Bellm and") - print("Federica Bianco and") - print("Johan Bregeon and") - print("Katja Bricman and") - print("Owen Boberg and") - print("Jeff Carlin and") - print("YuChia Chen and") - print("Will Clarkson and") - print("Andrew Connolly and") - print("Philippe Gris and") - print("Alina Hu and") - print("Michael Kelley and") - print("Somayeh Khakpash and") - print("Simon Krughoff and") - print("Xiaolong Li and") - print("Michael B. Lund and") - print("Phil Marshall and") - print("Josh Meyers and") - print("Loredana Prisinzano and") - print("Elahesadat Naghib and") - print("Meredith Rawls and") - print("Michael Reuter and") - print("Daniel Rothchild and") - print("Christian N. Setzer and") - print("Jonathan Sick and") - print(" Rachel Street},") - print("title = {lsst/rubin\\_sim: 0.12.1},") - print("month = sep,") - print("year = 2022,") - print("publisher = {Zenodo},") - print("version = {0.12.1},") - print("doi = {10.5281/zenodo.7087823},") - print("url = {https://doi.org/10.5281/zenodo.7087823}") - print("}") - - print("\n") - - print("@ARTICLE{2018Icar..303..181J,") - print( + "Anderson Banihirwe and John Leeman},\n" + ) + f.write("year = {2020},\n") + f.write("doi = {10.21105/joss.01943},\n") + f.write("url = {https://doi.org/10.21105/joss.01943},\n") + f.write("month = jan,\n") + f.write("publisher = {The Open Journal},\n") + f.write("volume = {5},\n") + f.write(" number = {45},\n") + f.write("pages = {1943},\n") + f.write("journal = {Journal of Open Source Software}\n") + f.write("}\n") + + f.write("\nPytables\n\n") + f.write("@Misc{pytables,\n") + f.write("author = {PyTables Developers Team},\n") + f.write("title = {{PyTables}: Hierarchical Datasets in {Python}},\n") + f.write("year = {2002--},\n") + f.write('url = "https://www.pytables.org/",\n') + f.write("}\n") + + f.write("\nREBOUND:\n\n") + _cite_rebound(f=f) + + + f.write("\nAdapted Functions From rubin_sim:\n\n") + + f.write("@software{peter_yoachim_2022_7087823,\n") + f.write("author = {Peter Yoachim and ") + f.write("R. Lynne Jones and ") + f.write("Eric H. Neilsen and ") + f.write("Tiago Ribeiro and ") + f.write("Scott Daniel and ") + f.write("Natasha Abrams and ") + f.write("Husni Almoubayyed and ") + f.write("Igor Andreoni and ") + f.write("Humna Awan and ") + f.write("Matthew R. Becker and ") + f.write(" Keaton Bell and ") + f.write("Eric Bellm and ") + f.write("Federica Bianco and ") + f.write("Johan Bregeon and ") + f.write("Katja Bricman and ") + f.write("Owen Boberg and ") + f.write("Jeff Carlin and ") + f.write("YuChia Chen and ") + f.write("Will Clarkson and ") + f.write("Andrew Connolly and ") + f.write("Philippe Gris and ") + f.write("Alina Hu and ") + f.write("Michael Kelley and ") + f.write("Somayeh Khakpash and ") + f.write("Simon Krughoff and ") + f.write("Xiaolong Li and ") + f.write("Michael B. Lund and ") + f.write("Phil Marshall and ") + f.write("Josh Meyers and ") + f.write("Loredana Prisinzano and ") + f.write("Elahesadat Naghib and ") + f.write("Meredith Rawls and ") + f.write("Michael Reuter and ") + f.write("Daniel Rothchild and ") + f.write("Christian N. Setzer and ") + f.write("Jonathan Sick and ") + f.write(" Rachel Street},\n") + f.write("title = {lsst/rubin\\_sim: 0.12.1},\n") + f.write("month = sep,\n") + f.write("year = 2022,\n") + f.write("publisher = {Zenodo},\n") + f.write("version = {0.12.1},\n") + f.write("doi = {10.5281/zenodo.7087823},\n") + f.write("url = {https://doi.org/10.5281/zenodo.7087823}\n") + f.write("}\n") + + f.write("\n\n") + + f.write("@ARTICLE{2018Icar..303..181J,\n") + f.write( "author = {{Jones}, R. Lynne and {Slater}, Colin T. and {Moeyens}, " "Joachim and {Allen}, Lori and {Axelrod}, Tim and {Cook}, Kem and " "{Ivezi{\\'c}}, {\v{Z}}eljko and {Juri{\\'c}}, Mario and {Myers}, Jonathan " - "and {Petry}, Catherine E.}," + "and {Petry}, Catherine E.},\n" ) - print('title = "{The Large Synoptic Survey Telescope as a Near-Earth Object discovery machine}",') - print("journal = {\\icarus},") - print( + f.write('title = "{The Large Synoptic Survey Telescope as a Near-Earth Object discovery machine}",\n') + f.write("journal = {\\icarus},\n") + f.write( "keywords = {Near-Earth objects, Image processing, Asteroids, " "Earth Science, Astrophysics - Earth and Planetary Astrophysics, " - "Astrophysics - Instrumentation and Methods for Astrophysics}," - ) - print("year = 2018,") - print("month = mar,") - print("volume = {303},") - print("pages = {181-202},") - print("doi = {10.1016/j.icarus.2017.11.033},") - print("archivePrefix = {arXiv},") - print("eprint = {1711.10621},") - print(" primaryClass = {astro-ph.EP},") - print("adsurl = {https://ui.adsabs.harvard.edu/abs/2018Icar..303..181J},") - print(" adsnote = {Provided by the SAO/NASA Astrophysics Data System}") - print("}") - - print("\nsbpy:\n") - print("@ARTICLE{2019JOSS....4.1426M,") - print( + "Astrophysics - Instrumentation and Methods for Astrophysics},\n" + ) + f.write("year = 2018,\n") + f.write("month = mar,\n") + f.write("volume = {303},\n") + f.write("pages = {181-202},\n") + f.write("doi = {10.1016/j.icarus.2017.11.033},\n") + f.write("archivePrefix = {arXiv},\n") + f.write("eprint = {1711.10621},\n") + f.write(" primaryClass = {astro-ph.EP},\n") + f.write("adsurl = {https://ui.adsabs.harvard.edu/abs/2018Icar..303..181J},\n") + f.write(" adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n") + f.write("}\n") + + f.write("\nsbpy:\n\n") + f.write("@ARTICLE{2019JOSS....4.1426M,\n") + f.write( "author = {{Mommert}, Michael and {Kelley}, Michael and {de Val-Borro}, Miguel " "and {Li}, Jian-Yang and {Guzman}, Giannina and {Sip{\\H{o}}cz}, Brigitta and " "{{\\v{D}}urech}, Josef and {Granvik}, Mikael and {Grundy}, Will and {Moskovitz}, Nick " - 'and {Penttil{\\"a}}, Antti and {Samarasinha}, Nalin},' + 'and {Penttil{\\"a}}, Antti and {Samarasinha}, Nalin},\n' ) - print('title = "{sbpy: A Python module for small-body planetary astronomy}",') - print("journal = {The Journal of Open Source Software},") - print( + f.write('title = "{sbpy: A Python module for small-body planetary astronomy}",\n') + f.write("journal = {The Journal of Open Source Software},\n") + f.write( "keywords = {comets, kuiper belt objects, Python, trans-neptunian objects, " "centaurs, planetary science, python, solar system, asteroids, meteoroids, " - "trojans, astronomy, small bodies}," - ) - print("year = 2019,") - print("month = aug,") - print("volume = {4},") - print("number = {38},") - print("eid = {1426},") - print("pages = {1426},") - print("doi = {10.21105/joss.01426},") - print("adsurl = {https://ui.adsabs.harvard.edu/abs/2019JOSS....4.1426M},") - print("adsnote = {Provided by the SAO/NASA Astrophysics Data System}") - print("}") - - print("\nSciPy:\n") - print("@ARTICLE{2020SciPy-NMeth,") - print("author = {Virtanen, Pauli and Gommers, Ralf and Oliphant, Travis E. and ") - print("Haberland, Matt and Reddy, Tyler and Cournapeau, David and ") - print("Burovski, Evgeni and Peterson, Pearu and Weckesser, Warren and ") - print("Bright, Jonathan and {van der Walt}, St{\\'{e}}fan J. and ") - print("Brett, Matthew and Wilson, Joshua and Millman, K. Jarrod and ") - print("Mayorov, Nikolay and Nelson, Andrew R. J. and Jones, Eric and ") - print("Kern, Robert and Larson, Eric and Carey, C J and ") - print("Polat, {\\.I}lhan and Feng, Yu and Moore, Eric W. and ") - print("{VanderPlas}, Jake and Laxalde, Denis and Perktold, Josef and ") - print("Cimrman, Robert and Henriksen, Ian and Quintero, E. A. and ") - print("Harris, Charles R. and Archibald, Anne M. and ") - print("Ribeiro, Ant{\\^o}nio H. and Pedregosa, Fabian and ") - print("{van Mulbregt}, Paul and {SciPy 1.0 Contributors}},") - print("title = {{{SciPy} 1.0: Fundamental Algorithms for Scientific ") - print("Computing in Python}},") - print("journal = {Nature Methods},") - print("year = {2020},") - print("volume = {17},") - print("pages = {261--272},") - print("adsurl = {https://rdcu.be/b08Wh},") - print("doi = {10.1038/s41592-019-0686-2},") - - print("}") - - print("\nSpice Resources:\n") - print(" @ARTICLE{1996P&SS...44...65A,") - print("author = {{Acton}, Charles H.},") - print("title = {Ancillary data services of " "NASA's Navigation and Ancillary Information Facility},") - print("journal = {\\planss},") - print("year = 1996,") - print("month = jan,") - print("volume = {44},") - print("number = {1},") - print("pages = {65-70},") - print("doi = {10.1016/0032-0633(95)00107-7},") - print("adsurl = {https://ui.adsabs.harvard.edu/abs/1996P&SS...44...65A},") - print("adsnote = {Provided by the SAO/NASA Astrophysics Data System}") - print("}") - - print("\n") - - print("@ARTICLE{2018P&SS..150....9A,") - print("author = {{Acton}, Charles and {Bachman}, Nathaniel and {Semenov}, Boris and {Wright}, Edward},") - print('title = "{A look towards the future in the handling of space science mission geometry}",') - print("journal = {\\planss},") - print("year = 2018,") - print("month = jan,") - print("volume = {150},") - print("pages = {9-12},") - print("doi = {10.1016/j.pss.2017.02.013},") - print("adsurl = {https://ui.adsabs.harvard.edu/abs/2018P&SS..150....9A},") - print("adsnote = {Provided by the SAO/NASA Astrophysics Data System} ") - print("}") - - print( - "\nAdd an acknowledgment statement: The SPICE Resource files used in this work ere described in \\citep{1996P&SS...44...65A, 2018P&SS..150....9A}" - ) - - print("\nSpiceypy:\n") - print("@ARTICLE{2020JOSS....5.2050A,") - print( + "trojans, astronomy, small bodies},\n" + ) + f.write("year = 2019,\n") + f.write("month = aug,\n") + f.write("volume = {4},\n") + f.write("number = {38},\n") + f.write("eid = {1426},\n") + f.write("pages = {1426},\n") + f.write("doi = {10.21105/joss.01426},\n") + f.write("adsurl = {https://ui.adsabs.harvard.edu/abs/2019JOSS....4.1426M},\n") + f.write("adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n") + f.write("}\n") + + f.write("\nSciPy:\n\n") + f.write("@ARTICLE{2020SciPy-NMeth,\n") + f.write("author = {Virtanen, Pauli and Gommers, Ralf and Oliphant, Travis E. and \n") + f.write("Haberland, Matt and Reddy, Tyler and Cournapeau, David and \n") + f.write("Burovski, Evgeni and Peterson, Pearu and Weckesser, Warren and \n") + f.write("Bright, Jonathan and {van der Walt}, St{\\'{e}}fan J. and \n") + f.write("Brett, Matthew and Wilson, Joshua and Millman, K. Jarrod and \n") + f.write("Mayorov, Nikolay and Nelson, Andrew R. J. and Jones, Eric and \n") + f.write("Kern, Robert and Larson, Eric and Carey, C J and \n") + f.write("Polat, {\\.I}lhan and Feng, Yu and Moore, Eric W. and \n") + f.write("{VanderPlas}, Jake and Laxalde, Denis and Perktold, Josef and \n") + f.write("Cimrman, Robert and Henriksen, Ian and Quintero, E. A. and \n") + f.write("Harris, Charles R. and Archibald, Anne M. and \n") + f.write("Ribeiro, Ant{\\^o}nio H. and Pedregosa, Fabian and \n") + f.write("{van Mulbregt}, Paul and {SciPy 1.0 Contributors}},\n") + f.write("title = {{{SciPy} 1.0: Fundamental Algorithms for Scientific \n") + f.write("Computing in Python}},\n") + f.write("journal = {Nature Methods},\n") + f.write("year = {2020},\n") + f.write("volume = {17},\n") + f.write("pages = {261--272},\n") + f.write("adsurl = {https://rdcu.be/b08Wh},\n") + f.write("doi = {10.1038/s41592-019-0686-2},\n") + + f.write("}\n") + + f.write("\nSpice Resources:\n\n") + f.write(" @ARTICLE{1996P&SS...44...65A,\n") + f.write("author = {{Acton}, Charles H.},\n") + f.write( + "title = {Ancillary data services of " "NASA's Navigation and Ancillary Information Facility},\n" + ) + f.write("journal = {\\planss},\n") + f.write("year = 1996,\n") + f.write("month = jan,\n") + f.write("volume = {44},\n") + f.write("number = {1},\n") + f.write("pages = {65-70},\n") + f.write("doi = {10.1016/0032-0633(95)00107-7},\n") + f.write("adsurl = {https://ui.adsabs.harvard.edu/abs/1996P&SS...44...65A},\n") + f.write("adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n") + f.write("}\n") + + f.write("\n\n") + + f.write("@ARTICLE{2018P&SS..150....9A,\n") + f.write( + "author = {{Acton}, Charles and {Bachman}, Nathaniel and {Semenov}, Boris and {Wright}, Edward},\n" + ) + f.write('title = "{A look towards the future in the handling of space science mission geometry}",\n') + f.write("journal = {\\planss},\n") + f.write("year = 2018,\n") + f.write("month = jan,\n") + f.write("volume = {150},\n") + f.write("pages = {9-12},\n") + f.write("doi = {10.1016/j.pss.2017.02.013},\n") + f.write("adsurl = {https://ui.adsabs.harvard.edu/abs/2018P&SS..150....9A},\n") + f.write("adsnote = {Provided by the SAO/NASA Astrophysics Data System} \n") + f.write("}\n") + + f.write( + "\nAdd an acknowledgment statement: The SPICE Resource files used in this work ere described in \\citep{1996P&SS...44...65A, 2018P&SS..150....9A}\n" + ) + + f.write("\nSpiceypy:\n\n") + f.write("@ARTICLE{2020JOSS....5.2050A,\n") + f.write( "author = {{Annex}, Andrew and {Pearson}, Ben and {Seignovert}, " "Beno{\\^\\i}t and {Carcich}, Brian and {Eichhorn}, Helge and {Mapel}, " "Jesse and {von Forstner}, Johan and {McAuliffe}, Jonathan and " "{del Rio}, Jorge and {Berry}, Kristin and {Aye}, K. -Michael and " "{Stefko}, Marcel and {de Val-Borro}, Miguel and {Kulumani}, Shankar " - "and {Murakami}, Shin-ya}, " - ) - print('title = "{SpiceyPy: a Pythonic Wrapper for the SPICE Toolkit}",') - print("journal = {The Journal of Open Source Software},") - print("keywords = {geometry, Python, spacecraft, Batchfile, planets, ephemeris, navigation, SPICE},") - print("year = 2020,") - print("month = feb,") - print("volume = {5},") - print("number = {46},") - print(" eid = {2050},") - print("pages = {2050},") - print("doi = {10.21105/joss.02050},") - print("adsurl = {https://ui.adsabs.harvard.edu/abs/2020JOSS....5.2050A},") - print("adsnote = {Provided by the SAO/NASA Astrophysics Data System}") - print("}") - - print("\ntqdm:\n") - print("@software{casper_da_costa_luis_2023_8233425,") - print("author = {Casper da Costa-Luis and") - print("Stephen Karl Larroque and") - print("Kyle Altendorf and") - print("Hadrien Mary and") - print("richardsheridan and") - print("Mikhail Korobov and") - print("Noam Yorav-Raphael and") - print("Ivan Ivanov and") - print("Marcel Bargull and") - print("Nishant Rodrigues and") - print("Guangshuo Chen and") - print("Antony Lee and") - print("Charles Newey and") - print("CrazyPython and") - print("JC and") - print("Martin Zugnoni and") - print("Matthew D. Pagel and") - print("mjstevens777 and") - print("Mikhail Dektyarev and") - print("Alex Rothberg and") - print(" Alexander Plavin and") - print("Fabian Dill and") - print("FichteFoll and") - print("Gregor Sturm and") - print("HeoHeo and") - print("Hugo van Kemenade and") - print("Jack McCracken and") - print("MapleCCC and") - print("Max Nordlund and") - print("Mike Boyle},") - print("title = {{tqdm: A fast, Extensible Progress Bar for Python ") - print("and CLI}},") - print("month = aug,") - print("year = 2023,") - print(" publisher = {Zenodo},") - print(" version = {v4.66.1},") - print("doi = {10.5281/zenodo.8233425},") - print("url = {https://doi.org/10.5281/zenodo.8233425}") - print("}") - - print("\nIf using a rubin_sim simulated survey pointing database:\n") - print( + "and {Murakami}, Shin-ya}, \n" + ) + f.write('title = "{SpiceyPy: a Pythonic Wrapper for the SPICE Toolkit}",\n') + f.write("journal = {The Journal of Open Source Software},\n") + f.write("keywords = {geometry, Python, spacecraft, Batchfile, planets, ephemeris, navigation, SPICE},\n") + f.write("year = 2020,\n") + f.write("month = feb,\n") + f.write("volume = {5},\n") + f.write("number = {46},\n") + f.write(" eid = {2050},\n") + f.write("pages = {2050},\n") + f.write("doi = {10.21105/joss.02050},\n") + f.write("adsurl = {https://ui.adsabs.harvard.edu/abs/2020JOSS....5.2050A},\n") + f.write("adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n") + f.write("}\n") + + f.write("\ntqdm:\n\n") + f.write("@software{casper_da_costa_luis_2023_8233425,\n") + f.write("author = {Casper da Costa-Luis and\n") + f.write("Stephen Karl Larroque and\n") + f.write("Kyle Altendorf and\n") + f.write("Hadrien Mary and\n") + f.write("richardsheridan and\n") + f.write("Mikhail Korobov and\n") + f.write("Noam Yorav-Raphael and\n") + f.write("Ivan Ivanov and\n") + f.write("Marcel Bargull and\n") + f.write("Nishant Rodrigues and\n") + f.write("Guangshuo Chen and\n") + f.write("Antony Lee and\n") + f.write("Charles Newey and\n") + f.write("CrazyPython and\n") + f.write("JC and\n") + f.write("Martin Zugnoni and\n") + f.write("Matthew D. Pagel and\n") + f.write("mjstevens777 and\n") + f.write("Mikhail Dektyarev and\n") + f.write("Alex Rothberg and\n") + f.write(" Alexander Plavin and\n") + f.write("Fabian Dill and\n") + f.write("FichteFoll and\n") + f.write("Gregor Sturm and\n") + f.write("HeoHeo and\n") + f.write("Hugo van Kemenade and\n") + f.write("Jack McCracken and\n") + f.write("MapleCCC and\n") + f.write("Max Nordlund and\n") + f.write("Mike Boyle},\n") + f.write("title = {{tqdm: A fast, Extensible Progress Bar for Python \n") + f.write("and CLI}},\n") + f.write("month = aug,\n") + f.write("year = 2023,\n") + f.write(" publisher = {Zenodo},\n") + f.write(" version = {v4.66.1},\n") + f.write("doi = {10.5281/zenodo.8233425},\n") + f.write("url = {https://doi.org/10.5281/zenodo.8233425}\n") + f.write("}\n") + + f.write("\nIf using a rubin_sim simulated survey pointing database:\n\n") + f.write( "Add an acknowledgment statement: This material or work is supported in part by the National Science " "Foundation through Cooperative Agreement AST-1258333 and " "Cooperative Support Agreement AST1836783 managed by the Association " "of Universities for Research in Astronomy (AURA), and the Department " "of Energy under Contract No. DE-AC02-76SF00515 with the SLAC National " - "Accelerator Laboratory managed by Stanford University." + "Accelerator Laboratory managed by Stanford University.\n" ) - print("\n") - print( + f.write("\n\n") + f.write( "If you are submitting a paper to AAS Journals, here is" " the software citation latex command you will need once you have included " "all of the above bibtex references above.\n" ) - print( + f.write( "\\software{" "Sorcha," "ASSIST \\citep{2023PSJ.....4...69H,hanno_rein_2023_7778017}," @@ -702,3 +711,26 @@ def cite_sorcha(): "Black (\\url{https://black.readthedocs.io/en/stable/faq.html}), " "Jupyter Notebooks \\citep{soton403913}}" ) + + +def _cite_rebound(f): + """ + Function to output the print statements from rebound.Simulation.cite() into the file like object. + Parameters + ----------- + f: file-like object + The output for where the citation information will be written. Default: sys.stdout + + Returns + ----------- + None + """ + #saving the default sys.stdout + original_stdout = sys.stdout + #making the sys.stdout output to f. + sys.stdout = f + sim = rebound.Simulation() + sim.cite() + #making the stdout default again + sys.stdout = original_stdout + \ No newline at end of file diff --git a/src/sorcha_cmdline/cite.py b/src/sorcha_cmdline/cite.py index b0f59eb9..2cf6b757 100644 --- a/src/sorcha_cmdline/cite.py +++ b/src/sorcha_cmdline/cite.py @@ -15,11 +15,11 @@ def main(): optional = parser.add_argument_group("Optional arguments") optional.add_argument( - "-cf", - "--cite-file-path", + "-o", + "--outfile", help="File path to store citation file sorcha_citation.txt.", type=str, - dest="cf", + dest="o", required=False, default=os.getcwd(), ) @@ -40,29 +40,18 @@ def main(): def execute(args): import sys - import io from sorcha.utilities.citation_text import cite_sorcha if args.p: # prints citation to terminal cite_sorcha() - if not os.path.isdir(args.cf): - sys.exit(f"ERROR: file path {args.cf} does not exist or isn't a directory") + if not os.path.isdir(args.o): + sys.exit(f"ERROR: file path {args.o} does not exist or isn't a directory") - output_file_path = os.path.join(args.cf, "sorcha_citation.txt") - - # Makes sdtdout output the print statements into a temporary file - output_capture = io.StringIO() - sys.stdout = output_capture - - cite_sorcha() + output_file_path = os.path.join(args.o, "sorcha_citation.txt") # writes the outputs in the temporary file to a text file - with open(output_file_path, "w") as output_file: - output_file.write(output_capture.getvalue()) - - # Resets stdout back to normal - sys.stdout = sys.__stdout__ - output_capture.close() + with open(output_file_path, "w") as f: + cite_sorcha(f=f) print(f"Citations have been written into {os.path.abspath(output_file_path)}") From e111c0a9749bee96c1af8c2e2aca13a7ff0e391a Mon Sep 17 00:00:00 2001 From: Ryan Lyttle Date: Tue, 14 Jan 2025 14:32:54 +0000 Subject: [PATCH 3/6] Used black and fixed a typo in docs --- docs/cite.rst | 2 +- src/sorcha/utilities/citation_text.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/cite.rst b/docs/cite.rst index 5929f36f..809ec8e6 100644 --- a/docs/cite.rst +++ b/docs/cite.rst @@ -22,7 +22,7 @@ Citing the Software Built-In Citation Function ---------------------------- -If you use ``Sorcha`` in your research, please do include a citation in your published papers for ``Sorcha`` and the software packages and resources that ``Sorcha'' is based on. There are two ways to find this information: +If you use ``Sorcha`` in your research, please do include a citation in your published papers for ``Sorcha`` and the software packages and resources that ``Sorcha`` is based on. There are two ways to find this information: The first is to create a text file of the citation by running the following command on the command line:: diff --git a/src/sorcha/utilities/citation_text.py b/src/sorcha/utilities/citation_text.py index da4d4e59..4460a47b 100644 --- a/src/sorcha/utilities/citation_text.py +++ b/src/sorcha/utilities/citation_text.py @@ -437,7 +437,6 @@ def cite_sorcha(f=sys.stdout): f.write("\nREBOUND:\n\n") _cite_rebound(f=f) - f.write("\nAdapted Functions From rubin_sim:\n\n") f.write("@software{peter_yoachim_2022_7087823,\n") @@ -725,12 +724,11 @@ def _cite_rebound(f): ----------- None """ - #saving the default sys.stdout + # saving the default sys.stdout original_stdout = sys.stdout - #making the sys.stdout output to f. + # making the sys.stdout output to f. sys.stdout = f sim = rebound.Simulation() sim.cite() - #making the stdout default again + # making the stdout default again sys.stdout = original_stdout - \ No newline at end of file From 10073c846955aafdb5b76037f367fd747de98d59 Mon Sep 17 00:00:00 2001 From: Ryan Lyttle Date: Tue, 14 Jan 2025 14:49:50 +0000 Subject: [PATCH 4/6] Added else statement --- src/sorcha_cmdline/cite.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/sorcha_cmdline/cite.py b/src/sorcha_cmdline/cite.py index 2cf6b757..d0e58c81 100644 --- a/src/sorcha_cmdline/cite.py +++ b/src/sorcha_cmdline/cite.py @@ -44,14 +44,15 @@ def execute(args): if args.p: # prints citation to terminal cite_sorcha() + else: - if not os.path.isdir(args.o): - sys.exit(f"ERROR: file path {args.o} does not exist or isn't a directory") + if not os.path.isdir(args.o): + sys.exit(f"ERROR: file path {args.o} does not exist or isn't a directory") - output_file_path = os.path.join(args.o, "sorcha_citation.txt") + output_file_path = os.path.join(args.o, "sorcha_citation.txt") - # writes the outputs in the temporary file to a text file - with open(output_file_path, "w") as f: - cite_sorcha(f=f) + # writes the outputs in the temporary file to a text file + with open(output_file_path, "w") as f: + cite_sorcha(f=f) - print(f"Citations have been written into {os.path.abspath(output_file_path)}") + print(f"Citations have been written into {os.path.abspath(output_file_path)}") From df664ff21336884375422d37eec3fc39809e2307 Mon Sep 17 00:00:00 2001 From: Meg Schwamb Date: Tue, 14 Jan 2025 14:57:55 +0000 Subject: [PATCH 5/6] update the description --- src/sorcha_cmdline/cite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sorcha_cmdline/cite.py b/src/sorcha_cmdline/cite.py index 2cf6b757..d24ff790 100644 --- a/src/sorcha_cmdline/cite.py +++ b/src/sorcha_cmdline/cite.py @@ -10,7 +10,7 @@ def main(): parser = SorchaArgumentParser( prog="sorcha cite", formatter_class=argparse.ArgumentDefaultsHelpFormatter, - description="Providing the bibtex, AAS Journals software latex command, and acknowledgement statements for Sorcha and the associated packages that power it in a file called sorcha_citation.txt.", + description="Providing the bibtex, AAS Journals software latex command, and acknowledgement statements for Sorcha and the associated packages that power it in a file (sorcha_citation.txt (by default) or printed to the terminal (standard out).", ) optional = parser.add_argument_group("Optional arguments") From b9b33ec036deb58880c903a039635b1533b74ac7 Mon Sep 17 00:00:00 2001 From: Meg Schwamb Date: Tue, 14 Jan 2025 15:00:20 +0000 Subject: [PATCH 6/6] Update cite.py fixing description typo --- src/sorcha_cmdline/cite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sorcha_cmdline/cite.py b/src/sorcha_cmdline/cite.py index 2bc3608f..24aebc7d 100644 --- a/src/sorcha_cmdline/cite.py +++ b/src/sorcha_cmdline/cite.py @@ -10,7 +10,7 @@ def main(): parser = SorchaArgumentParser( prog="sorcha cite", formatter_class=argparse.ArgumentDefaultsHelpFormatter, - description="Providing the bibtex, AAS Journals software latex command, and acknowledgement statements for Sorcha and the associated packages that power it in a file (sorcha_citation.txt (by default) or printed to the terminal (standard out).", + description="Providing the bibtex, AAS Journals software latex command, and acknowledgement statements for Sorcha and the associated packages that power it in a file (sorcha_citation.txt) by default or printed to the terminal (standard out).", ) optional = parser.add_argument_group("Optional arguments")