Jump to content

NLCbanner2024.jpg.2478be509670e60c2d6efd04834b8b47.jpg

Astropy help for a newbie.


Recommended Posts

Anyone here use astropy for their data analysis and can help a clueless newbie get started?

(Er, sorry, the politically correct term appears to be "differently clued".)

So far  my coding has been in Perl with some use of  IRAF. I also use a bunch of pre-packaged utiliies such as SWarp, SExtractor, Astrometrica and APT. Python is clearly the way forward (we won't go into IDL pro tem) and I badly need to get up to speed.

Looking for very simple tutorials, documentation, examples, hand-holding, and so on. Already done searches with DuckDuckGo but its all rather confusing for a bear of very little brain like I.

Thanks, Paul

Link to comment
Share on other sites

Regarding the AI comment, I’ve found ChatGPT very handy for Astropy. It’s best used in small amounts; don’t ask it to write the whole program. And keep in mind it won’t necessarily be right, or give efficient code - but I still found it much faster to get to the end result than googling or reading astropy docs.

Link to comment
Share on other sites

Hello Paul.

Are you asking about help with Astropy in particular or Python as a programming language?

I’ve dabbled with Astropy and have it installed alongside/included with Anaconda, but much of the published help docs assume you already have a basic knowledge of Python programming.

Starting off with Astropy and no underlying experience with Python is going to be hard IMO however you can get started with these tutorials:

https://learn.astropy.org

If you know the fundamentals of Python then Astropy becomes much simpler so maybe a parallel approach is needed, a good primer in  Python programming alongside the Astropy docs.

With Astropy being mainly confined to the educational/professional astronomy field I think you’re going to find specific Astropy help hard to come by in the amateur astronomy realm.

Like you, I’ve some experience with IRAF and c-munipack but mostly still using ImageJ/AstroImageJ.

  • Thanks 1
Link to comment
Share on other sites

7 minutes ago, Oddsocks said:

Hello Paul.

Are you asking about help with Astropy in particular or Python as a programming language?

I’ve dabbled with Astropy and have it installed alongside/included with Anaconda, but much of the published help docs assume you already have a basic knowledge of Python programming.

Starting off with Astropy and no underlying experience with Python is going to be hard IMO however you can get started with these tutorials:

https://learn.astropy.org

If you know the fundamentals of Python then Astropy becomes much simpler so maybe a parallel approach is needed, a good primer in  Python programming alongside the Astropy docs.

With Astropy being mainly confined to the educational/professional astronomy field I think you’re going to find specific Astropy help hard to come by in the amateur astronomy realm.

Like you, I’ve some experience with IRAF and c-munipack but mostly still using ImageJ/AstroImageJ.

I have been programming n Algol-like languages since the days of Algol 60. I have dabbled in Python but not yet used it for anything significant. The O'Reilly books are very good, I have found, and "Python in easy steps" is a fine introduction.

The language doesn't worry me too much, in other words. These days, however, whatever one uses, it's not the language that's the problem but the ecosystem it supports --- whether that be CPAN, CRAN, astropy, or whatever. Finding one's way through the jungle can be daunting.

  • Like 1
Link to comment
Share on other sites

1 hour ago, Xilman said:

it's not the language that's the problem but the ecosystem it supports --- whether that be CPAN, CRAN, astropy, or whatever. Finding one's way through the jungle can be daunting.

Paul.

If you want an integrated environment/ecosystem to use Astropy in have a look at Anaconda, it's free, cross-platform, and is also the BAA recommended environment for HOPS software (Exoplanet transit timing).

Being a Mac user (and before retirement having a company provided MATLAB license that unfortunately had to be surrendered) there's not such a wide field of Mac compatible apps to choose from but I've found Anaconda with included JupyterLab and Spyder almost as good as MATLAB, does everything I need anyway.

With Astropy included in the Anaconda distribution it's relatively simple to keep Astropy updated and download any necessary libraries for your Astropy projects through the Anaconda platform.

+1 for the O'Reilly books, my Java and JavaScript copies have proved indispensable.

William.

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Oddsocks said:

Paul.

If you want an integrated environment/ecosystem to use Astropy in have a look at Anaconda, it's free, cross-platform, and is also the BAA recommended environment for HOPS software (Exoplanet transit timing).

Thanks for this advice, especially about JuppyterLab and Spyder. Very helpful.  I already have HOPS installed, so to that extent I already "use" astropy. In my case I set up a virtual environment rather than install Anaconda  to load any modules not already provided by the Ubuntu repository. However, my knowledge is still at the level of driving a GUI application, rather than building one for myself. That's my ultimate aim, though I realise that it will take quite some self-education.

A long term aim, for instance, is to re-implement Astrometrica so that it is multi-platform, open source and omits what I believe to be egregious mis-features.  A long-term aim indeed.

(Thoroughly off-topic: anyone else here old enough to have used Algol 60 and, especially, Algol 68? The latter is alive and well and I still code in it. For sheer elegance A68 remains my favourite programming language. The libraries available are not as extensive as those for Perl, Python, R, Fortran, et al. but thoroughly capable.

pcl@thoth:~$ a68g -v
Algol 68 Genie 3.1.0
Copyright 2001-2022 Marcel van der Veer <algol68g@xs4all.nl>.

This is free software covered by the GNU General Public License.
There is ABSOLUTELY NO WARRANTY for Algol 68 Genie;
not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

Please report bugs to Marcel van der Veer <algol68g@xs4all.nl>.

With hardware support for long modes
With compilation support
     C compiler is gcc
With parallel-clause support
With GNU MP 6.3.0
With GNU MPFR 4.2.1
With mathlib from R 4.1.2
With GNU Scientific Library 2.7.1
With GNU plotutils 4.4
With curses 6.3
With TCP/IP support
With PostgreSQL support
GNU libc version glibc 2.39
GNU libpthread version NPTL 2.39
pcl@thoth:~$ 
)

Right, advertising over. Back to work.

  • Like 1
Link to comment
Share on other sites

6 hours ago, Oddsocks said:

... included JupyterLab and Spyder almost as good as MATLAB, does everything I need anyway.

Again, thanks. Spyder has been very useful. I already have (almost all of) a command-line reproduction of imhead(1) from WCSTools and will shortly start work on  a Tk GUI application. I hope that my Perl/Tk experience will help there.

Proof of concept code right now. Mustn't get too ambitious too early.

  • Like 1
Link to comment
Share on other sites

On 04/07/2024 at 12:37, Oddsocks said:

Being a Mac user (and before retirement having a company provided MATLAB license that unfortunately had to be surrendered) there's not such a wide field of Mac compatible apps to choose from but I've found Anaconda with included JupyterLab and Spyder almost as good as MATLAB, does everything I need anyway.
 

GNU Octave is a cross platform, open source MATLAB alternative which could be of use. Caveat - I've only used it seriously once to do some FFT analysis of waveforms. However all the example MATLAB scripts I found online worked fine, including ones for graphing/plotting.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Bit late to the party, but for an existing programmer I can recommend the following

https://github.com/jakevdp/WhirlwindTourOfPython

to get rapidly up to speed with Python, and from the same guy (an astronomer no less!) this:

https://jakevdp.github.io/PythonDataScienceHandbook/

which covers Numpy amongst other things that will be useful when using Astropy.

If you're developing interfaces with Python I recommend looking at PySide (Qt for Python) and the QML language. In my opinion this is by far the best-supported and robust GUI toolkit for Python.

I was taught Algol 68 by Charles Lindsey at Manchester University in the early 80s. I recall that we had to code up a Travelling Salesperson Problem and apply it to the USA state capitals -- which occasionally comes in useful for pub quizzes 🙂. What sticks in my mind is the arcane 3-ref trick for some reason. I'm just very glad the likes of Python has more or less elevated programming to an enjoyable activity again 😉 

 

 

 

Edited by Martin Meredith
added Wiki link to Lindsey
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.