Can I Use the Lucy Subprogram in Starlink Project for Fortran Routines?

  • Context: Fortran 
  • Thread starter Thread starter faeriewhisper
  • Start date Start date
  • Tags Tags
    Beginner Fortran
Click For Summary
SUMMARY

The discussion centers on the use of the Lucy subprogram from the Starlink Project's KAPPA library within Fortran routines. The user seeks to call the Lucy subprogram in their Fortran code but encounters limitations due to the subroutine's design, which only accepts a status argument and does not facilitate direct data passing. The compiled Lucy file is located at $HOME/Astronomy/Software/star-2015A/bin/kappa/lucy, and the source code can be accessed on GitHub. The consensus is that significant modifications would be required to adapt Lucy for standalone use.

PREREQUISITES
  • Familiarity with Fortran programming and syntax
  • Understanding of the Starlink Project and its KAPPA library
  • Knowledge of compiling Fortran code using gfortran
  • Basic experience with GitHub for accessing source code
NEXT STEPS
  • Explore the Starlink Project documentation for KAPPA and its subprograms
  • Learn how to modify Fortran subroutines to accept additional arguments
  • Investigate alternative methods for data passing in Fortran routines
  • Review the source code of lucy.f on GitHub for potential adaptation strategies
USEFUL FOR

Fortran developers, astronomers utilizing the Starlink Project, and anyone interested in integrating KAPPA library functionalities into their Fortran applications.

faeriewhisper
Messages
4
Reaction score
0
Hello!
I'm trying to use a subprogram from the Starlink Project - Lucy in the library KAPPA - that is already installed and compiled. The idea is to be able to call it from my fortran routine.

Something like this:
Code:
PROGRAM ex
 
INTEGER i
REAL in(10),psf(10),out(10)
 
DO i =1,10
  in(i) = rand()
  psf(i) = rand()
ENDDO

lucy in psf out

WRITE(*,*)out

END

Is that possible?
If so, how should I compile the file (using gfortran)?

After downloading and unpacking the Starlink package you write in the terminal:

$ export STARLINK_DIR=$HOME/Astronomy/Software/star-2015A
$ source $STARLINK_DIR/etc/profile

After that you can run the subprograms by typing:
$ kappa
$ lucy

The compiled lucy file can be found here: $HOME/Astronomy/Software/star-2015A/bin/kappa/lucy

The source file lucy.f can be found here: https://github.com/Starlink/starlink/blob/master/applications/kappa/libkappa/lucy.f

Many thanks in advance!
 
Technology news on Phys.org
You would have to use
Fortran:
call lucy (status)
But the subroutine lucy doesn't take in any other argument than that status, so I don't see how you can pass data to and from your own program.

After a quick look at the source code, it doesn't appear that the subroutine was intended to be used on its own. I think it would take quite some work to disentangle it from the main program.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 9 ·
Replies
9
Views
9K
  • · Replies 1 ·
Replies
1
Views
2K