package leigh.astro.iraf;

import java.util.ArrayList;
import java.util.List;

/**
 * This class contains photometric data for a astronomical science image.
 *
 * @author Alex Leigh
 */
public class Photometry {
    private final List<StarInfo> stars = new ArrayList<>();


    public void addStar(StarInfo star) {
        stars.add(star);
    }

    public int getCount() {
        return stars.size();
    }

    public double averageHWHM() {
        double x = 0;
        for (StarInfo star : stars) {
            x += star.getHwhm();
        }
        return x / stars.size();
    }

    public double averageFWHM() {
        return averageHWHM() * 2;
    }

    public double averageSharp() {
        double x = 0;
        for (StarInfo star : stars) {
            x += star.getSharp();
        }
        return x / stars.size();
    }

    public double averageRound() {
        double x = 0;
        for (StarInfo star : stars) {
            x += star.getRound();
        }
        return x / stars.size();
    }

    public List<StarInfo> getStars() {
        return stars;
    }

    @Override
    public String toString() {
        return "Photometry{" +
                "stars=" + stars +
                '}';
    }
}
