r/Astronomy • u/DaennoBlatt • 44m ago
Question (Describe all previous attempts to learn / understand) Terminal tasks within python
Hi, I am using Python with Jupyter Notebooks on MacBook. Is it possible to perform tasks you would normally do in the terminal within python? In my explicit case, I want to use SExtractor (Source extractor that finds light sources in image...) and then perform calculations with the created source table. But SExtractor does not have a visual interface and just works via inputs in the terminal. Is it possible to perform those taks within a python script if you know what I mean?
1
Upvotes
•
u/CharacterUse 27m ago
Yes: the other two answers explain how to call CLI functions from within python.
But: you could also use sewpy which wraps sextractor from within python:
https://github.com/megalut/sewpy
•
u/tyme 38m ago edited 33m ago
Yes. A few sources for info:
https://www.digitalocean.com/community/tutorials/python-system-command-os-subprocess-call
https://martinheinz.dev/blog/98
https://www.geeksforgeeks.org/python/executing-shell-commands-with-python/
https://www.reddit.com/r/learnpython/s/H9irGjpUsz
•
u/MadHatter__ 37m ago
Use os.system to call command line functions from within python