cd "/newdata"
//cd "c:/Users/ott/Desktop/LBT/LUCI/20171024"

ooo1 = ""

luci_ = 1

manualfilenames=["/tmp/hhh1.fits","/tmp/hhh2.fits","/tmp/hhh3.fits"]
if (nelements(manualfilenames) > 0) {
filenames_ = manualfilenames
} else {
filenames_ = findfile("luci" + luci_ + "*.fits")
n = nelements(filenames_)
filenames_ = filenames_[n-2:n]
updategui "luci1files", filenames_
}

Diff_ = preparediff(filenames_)
MaskIm_ = readfits(filenames_[3])
Mask_ = preparemask(MaskIm_)
OMask_ = outline(Mask_, 2)
Sim = preparesim(Diff_, OMask_)
view Sim,/scale995,/linear
message "Please mark star and mask positions using the \"m\" key"
cent_ = markpos(Sim)
/*
result1_ = offsets(cent_, Diff_, Mask_, luci_)
updategui "luci1align", result1_
luci1dx = result1_[1]
luci1dy = result1_[2]
luci1dphi = result1_[3]
ooo1 += "luci1: xshift: " + result1_[1] + " yshift: " + result1_[2] + " angle: " + result1_[3]
preview1 = shift(rotate(Diff_, -result1_[3], 1009.5, 1033.4), result1_[4], result1_[5]) + 2 * max(Diff_) * OMask_
view preview1, /scale995, /linear
*/

