gaelccc / pyRTX

1 stars 2 forks source link

Effective area computation #5

Closed paolocappuccio closed 1 year ago

paolocappuccio commented 2 years ago

Is it possible to extract the total effective area from a pyRTX.Spacecraft instance? Is it possible to extract the effective area of the single elements of the single pyRTX.Spacecraft?

gaelccc commented 2 years ago

Interesting questions. Regarding the first question an utility function has been added:

from pyRTX.scClass import Spacecraft
from util_functions import get_spacecraft_area

sc = Spacecraft( ... )
area = get_spacecraft_area(sc, ra = 0.0, dec = 0.0, epoch = epoch)

More details can be found in the documentation of the get_spacecraft_area:

Compute a pyRTX.Spacecraft apparent area as seen by the direction specified 
by a pair of right ascension - declination

Input:
spacecraft [pyRTX.Spacecraft] : the spacecraft object
ra [float]  : right ascension (in rad)
dec [float] : declination (rad)
epoch [float or None] : epoch for the computation (this is used when moving Spice
                                    frames are used for the Spacecraft definition)

Output:
area [float]  : the apparent area. The measurement units depend on the units of the
                                    Spacecraft object

TODO: avoid hardcoded width/height but rather use an automated method_

As it can be seen in the TODO section, this method still has some hardcoded parameters, related to the long-lasting issue of automating the computation of the required dimension of the pixel plane (suggestions are welcome!)

Regarding the second question a method has been added to the Spacecraft class:

Spacecraft.subset()

See the class documentation for more details:

     Return an instance of Spacecraft with only the elements contained
    in the list elem_names.
    Suppose the Spacecraft (self) is composed of elements A,B,C
    Spacecraft.subset(['A','B']) would return a new instance
    of Spacecraft with only the elements A and B_

An example:

Suppose the spacecraft sc is composed by parts A,B,C and we want to compute only the area of part A

sc = Spacecraft( ... )
A = sc.subset(['A'])
area = get_spacecraft_area(A, ra = 0.0, dec = 0.0, epoch = epoch)

Note: the sc.subset() method returns a (subset) clone of the original instance of sc, thus it can be used for anything the Spacecraft class is designed for (SRP computatiion, Albedo computation, ray tracing, etc..)

Do these modifications resolve your questions?