Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes #101

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ With the dependencies installed, we can install STVID using the following comman
```bash
sudo apt install python-is-python3 python3-pip # Install python3 and pip
cd $HOME/software # Goto directory
git clone https:/github.com/cbassa/stvid.git # Clone STVID repository
git clone https://github.com/cbassa/stvid.git # Clone STVID repository
cd $HOME/software/stvid # Goto directory
pip install -r requirements.txt # Install python requirements
```
Expand Down
12 changes: 7 additions & 5 deletions keogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import print_function
import glob
import numpy as np
from stvid.stio import fourframe
from stvid.fourframe import FourFrame
import configparser
import argparse
import os
Expand All @@ -13,12 +13,12 @@

def generate_keogram(path):
# Get files
fnames = sorted(glob.glob(os.path.join(path, "processed/2*.fits")))
fnames = sorted(glob.glob(os.path.join(path, "2*.fits")))

# Allocate arrays
nx = len(fnames)
ny = cfg.getint('Camera', 'camera_y')
ixmid = cfg.getint('Camera', 'camera_x') // 2
ny = cfg.getint(camera_type, "ny")
ixmid = cfg.getint(camera_type, "nx") // 2
keogram = np.zeros(nx * ny).reshape(ny, nx)
mjds = np.zeros(nx)

Expand All @@ -28,7 +28,7 @@ def generate_keogram(path):
print(i, fname)

# Read file
ff = fourframe(fname)
ff = FourFrame(fname, cfg)

# Extract data
keogram[:, i] = ff.zavg[:, ixmid]
Expand Down Expand Up @@ -65,6 +65,8 @@ def generate_keogram(path):
else:
cfg.read('configuration.ini')

camera_type = cfg.get("Setup", "camera_type")

# Generate keogram is it does not exist
if not os.path.exists(os.path.join(args.file_dir, "keogram.npy")):
generate_keogram(args.file_dir)
Expand Down
2 changes: 1 addition & 1 deletion stvid/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def calibrate(fname, cfg, astcat, pixcat, wref, tref):
dra = (t.sidereal_time("mean", "greenwich") - tref.sidereal_time("mean", "greenwich"))

# Updated position
p = FK5(ra=pref.ra + dra, dec=pref.dec, equinox=t).transform_to(ICRS)
p = FK5(ra=pref.ra + dra, dec=pref.dec, equinox=t).transform_to(ICRS())
w.wcs.crval = np.array([p.ra.degree, p.dec.degree])

# Exit on empty star catalog
Expand Down
16 changes: 12 additions & 4 deletions stvid/fourframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,19 @@ def __init__(self, satno, cospar, mjd, ra, dec, x, y, rx, ry, state, tlefile, ag
self.prx = self.rx
self.pry = self.ry
elif len(self.t) == 2:
self.prx = np.polyfit(self.t, self.rx, 1)
self.pry = np.polyfit(self.t, self.ry, 1)
try:
self.prx = np.polyfit(self.t, self.rx, 1)
self.pry = np.polyfit(self.t, self.ry, 1)
except:
self.prx = self.rx
self.pry = self.ry
else:
self.prx = np.polyfit(self.t, self.rx, 2)
self.pry = np.polyfit(self.t, self.ry, 2)
try:
self.prx = np.polyfit(self.t, self.rx, 2)
self.pry = np.polyfit(self.t, self.ry, 2)
except:
self.prx = self.rx
self.pry = self.ry

def position_and_velocity(self, t):
# Derivatives
Expand Down