Astro-SkyX
view release on metacpan or search on metacpan
SkyX_Test.pl view on Meta::CPAN
print "imageWidthInPixels: " . $SX->ImageLinkResults->imageWidthInPixels . "\n";
print "imageHeightInPixels: " . $SX->ImageLinkResults->imageHeightInPixels . "\n";
print "imageIsMirrored: " . $SX->ImageLinkResults->imageIsMirrored . "\n";
print "imageFilePath: " . $SX->ImageLinkResults->imageFilePath . "\n";
print "imageStarCount: " . $SX->ImageLinkResults->imageStarCount . "\n";
print "imageFWHMinArcSeconds: " . $SX->ImageLinkResults->imageFWHMinArcSeconds . "\n";
print "solutionRMS: " . $SX->ImageLinkResults->solutionRMS . "\n";
print "solutionRMSX: " . $SX->ImageLinkResults->solutionRMSX . "\n";
print "solutionRMSY: " . $SX->ImageLinkResults->solutionRMSY . "\n";
print "solutionStarCount: " . $SX->ImageLinkResults->solutionStarCount . "\n";
print "catalogStarCount: " . $SX->ImageLinkResults->catalogStarCount . "\n";
}else{
print "Failed!\n";
print "errorCode: " . $SX->ImageLinkResults->errorCode . "\n";
print "errorText: " . $SX->ImageLinkResults->errorText . "\n";
print "searchAborted: " . $SX->ImageLinkResults->searchAborted . "\n";
}
print "Finished testing ImageLinkResults module.\n";
sleep 1;
}
sub testsky6ObjectInformation {
print "Testing sky6ObjectInformation module.\n";
my $target = shift;
my $PropCnt = 197;
my $p;
my $i;
print "Finding $target...\n";
$SX->sky6StarChart->Find($target);
# Full checkout of Astro::SkyX::sky6ObjectInformation module.
for ( $i = 0; $i < $SX->sky6ObjectInformation->Count; $i++ ) {
$SX->sky6ObjectInformation->Index($i);
for ( $p = 0; $p <= $PropCnt; $p++) {
next if $p == 11;
if ( $SX->sky6ObjectInformation->PropertyApplies($p) ) {
#Latch the property into ObjInfoPropOut
$SX->sky6ObjectInformation->PropertyName($p);
my $value = $SX->sky6ObjectInformation->ObjInfoPropOut . ": ";
$SX->sky6ObjectInformation->Property($p);
print $p . " - " . $SX->sky6ObjectInformation->Index . " - " . $value . $SX->sky6ObjectInformation->ObjInfoPropOut . "\n";
}
}
}
print "Finished testing sky6ObjectInformation module.\n";
sleep 1;
}
sub testsky6DataWizard{
print "Testing sky6DataWizard module.\n";
my $target = shift;
$SX->sky6DataWizard->Path("$target");
$SX->sky6DataWizard->Open();
print "sky6DataWizardPath set to : " . $SX->sky6DataWizard->Path() . "\n";
my $Result = $SX->sky6DataWizard->RunQuery;
print "Query of sky6DataWizard complete.\n";
sleep 1;
}
sub testsky6DirectGuide {
print "Testing 100% of sky6DirectGuide module.\n";
$SX->sky6DirectGuide->IAsynchronous(0);
print " IAsynchronous set to: " . $SX->sky6DirectGuide->IAsynchronous . "\n";
$SX->sky6DirectGuide->MoveTelescope(900,900);
print "Finished testing sky6DirectGuide module.\n";
sleep 1;
}
sub testsky6MyFOVs {
print "Testing sky6MyFOVs module.\n";
my $PropCnt = 5;
my $p;
my $i;
for ( $i = 0; $i < $SX->sky6MyFOVs->Count; ++$i ) {
$SX->sky6MyFOVs->Name($i);
my $FOVName = $SX->sky6MyFOVs->OutString;
print "FOV Name: " . $FOVName . "\n";
for ( $p = 0; $p <= $PropCnt; ++$p) {
$SX->sky6MyFOVs->Property($FOVName,0,$p);
print " Property Value $p: " . $SX->sky6MyFOVs->OutVar . "\n";
}
}
print "Finished testing sky6MyFOVs module.\n";
sleep 1;
}
sub testsky6RASCOMTheSky {
print "Testing sky6RASCOMTheSky module.\n";
# Testing only non-superceded functions not replaced in other modules
# AutoMap() - Not tested - I'm too lazy
# print "Add AutoMap entry\n";
# $SX->sky6RASCOMTheSky->AutoMap();
# ConnectDome - No dome license. Not tested.
# CoupleDome - No dome license. Not tested.
# DisconnectTelescope
$SX->sky6RASCOMTheSky->DisconnectTelescope();
# DisconnectDome - No dome license. Not tested.
# Quit - Tested, but commented out to keep SkyX from exiting
# print "Finished. Shutting down.\n";
# $SX->sky6RASCOMTheSky->Quit();
print "Finished testing sky6RASCOMTheSky module.\n";
sleep 1;
}
sub testsky6RASCOMTele {
my $target = shift;
print "Testing sky6RASCOMTele module.\n";
# Abort() - Not tested
# CommutateMotors - Not tested.
print " Connecting to mount, Set Asynchronous mode off, and Unpark\n";
$SX->sky6RASCOMTele->Connect();
if ($SX->sky6RASCOMTele->IsConnected) {
print " Connected to Telescope. \n";
}else{
print " Did not connect to Telescope! \n";
}
$SX->sky6RASCOMTele->Asynchronous(0);
$SX->sky6RASCOMTele->Unpark();
# DoCommand() - Not tested (I have a paramount)
print " Testing FindHome\n";
$SX->sky6RASCOMTele->FindHome();
print " Home.\n";
sleep 1; # Needed on some systems if issuing a slew
# command immediatly after FindHome()
# Connect and move focuser
print " Connecting to Focuser\n";
$SX->ccdsoftCamera->focConnect();
print " Moving Focuser\n";
$SX->sky6RASCOMTele->FocusOutFast();
sleep 10;
$SX->sky6RASCOMTele->FocusInFast();
sleep 10;
$SX->sky6RASCOMTele->FocusOutSlow();
sleep 10;
$SX->sky6RASCOMTele->FocusInSlow();
sleep 10;
print " Finished Focuser In/Out/Fast/Slow\n";
# populate dAlt,dAz,dRa, and dDec and display them
print " Slewing to $target.\n";
$SX->sky6Web->SlewToObject($target);
while ( ! defined($SX->sky6RASCOMTele->IsSlewComplete) or $SX->sky6RASCOMTele->IsSlewComplete ne '1' ) {
print " Slewing...\n";
select(undef,undef,undef,4);
}
print " Call GetAzAlt, GetRaDec, and display \n";
$SX->sky6RASCOMTele->GetAzAlt();
$SX->sky6RASCOMTele->GetRaDec();
print " Alt is " . $SX->sky6RASCOMTele->dAlt . "\n";;
print " Az is " . $SX->sky6RASCOMTele->dAz . "\n";;
print " RA is " . $SX->sky6RASCOMTele->dRa . "\n";;
print " Dec is " . $SX->sky6RASCOMTele->dDec . "\n";;
my $dRa = $SX->sky6RASCOMTele->dRa;
my $dDec = $SX->sky6RASCOMTele->dDec;
print " Returning home to test SlewToRaDec\n";
$SX->sky6RASCOMTele->FindHome();
print " Testing SlewToRaDec\n";
$SX->sky6RASCOMTele->SlewToRaDec($dRa,$dDec,$target);
while ( ! defined($SX->sky6RASCOMTele->IsSlewComplete) or $SX->sky6RASCOMTele->IsSlewComplete ne '1' ) {
print " Slewing...\n";
select(undef,undef,undef,4);
}
# Jog() - Not tested
# Park() - Not tested
# Sync() - Not tested
# SlewToAzAlt() - Not tested
# SetParkPosition() - Not tested
# Turn tracking off
print " Turn tracking off. \n";
$SX->sky6RASCOMTele->SetTracking(0,1,0,0);
# Check to see if tracking is on
if ($SX->sky6RASCOMTele->IsTracking) {
print " Tracking is On. \n";
}else{
print " Tracking is Off. \n";
}
print "Finished testing sky6RASCOMTele module.\n";
sleep 1;
}
sub testsky6Web {
print "Testing sky6Web module.\n";
if (!$SX->sky6RASCOMTele->IsConnected) {
print " Connecting to Telescope. \n";
$SX->sky6RASCOMTele->Connect();
}else{
print " Already connected to Telescope. Starting Slew. \n";
}
# Point to $target and wait for it to finish slewing
my $target = shift;
print " Slewing to $target\n";
$SX->sky6Web->SlewToObject($target);
while ( ! defined($SX->sky6RASCOMTele->IsSlewComplete) or $SX->sky6RASCOMTele->IsSlewComplete ne '1' ) {
print " Slewing...\n";
select(undef,undef,undef,4);
}
print " Slew Complete.\n" if $SX->sky6RASCOMTele->IsSlewComplete;
print "Completed testing sky6Web module.\n";
sleep 1;
}
sub testccdsoftCamera {
# TheSkyX.ccdSoftCamera - added filterWheelConnect(), filterWheelDisconnect() and filterWheelIsConnected() methods().
# CCDSoft2XAdaptor.ccdSoft5Image.DataArray now returns a 2-D array instead of a 1-D array, just like CCDSoft.
# CCDSoft2XAdaptor.ccdSoft5Image.Width and Height properties no longer return "member not found".
# CCDSoft2XAdaptor.ccdSoft5Camera methods that do filter wheel operations do nothing if there is no filter wheel connection, just like CCDSoft.
# CCDSoft2XAdaptor.ccdSoft5Camera.lNumberFilters returns zero when not connected, just like CCDSoft.
# A LOT more tests need to be added.
print "Testing ccdsoftCamera module.\n";
print " Connecting to Main Imager\n";
# We'll use this later
# ccdsoftCamera::LastImageFileName
$SX->ccdsoftCamera->Autoguider(0);
$SX->ccdsoftCamera->Frame(1);
$SX->ccdsoftCamera->Connect();
$SX->ccdsoftCamera->Asynchronous(0);
$SX->ccdsoftCamera->ImageUseDigitizedSkySurvey(1);
$SX->ccdsoftCamera->AutoSaveOn(1);
print " Taking photo (DSS)\n";
$SX->ccdsoftCamera->ExposureTime(1);
$SX->ccdsoftCamera->TakeImage();
print " Connecting to Focuser\n";
$SX->ccdsoftCamera->focConnect();
print " Moving in 50 steps.\n";
$SX->ccdsoftCamera->focMoveIn(50);
sleep 5;
print " Moving out 50 steps.\n";
$SX->ccdsoftCamera->focMoveOut(50);
my $numFilters = $SX->ccdsoftCamera->lNumberFilters;
if ($numFilters =~ /^[+-]?\d+$/ ) {
my $i = 0;
for ( $i = 0; $i < $numFilters; ++$i ) {
print " Filter position $i - Name: " . $SX->ccdsoftCamera->szFilterName($i) . "\n";
}
}else{
print " Got a filter error: $numFilters \n";
}
print "Finished testing ccdsoftCamera module.\n";
sleep 1;
}
sub testccdsoftCameraImage {
my $testImage = shift;
print "Testing ccdsoftCameraImage module.\n";
$SX->ccdsoftCameraImage->Path($testImage);
print " Image path set to: " . $SX->ccdsoftCameraImage->Path() . "\n";
print " test path $testImage\n";
$SX->ccdsoftCameraImage->Open();
$SX->ccdsoftCameraImage->ScaleInArcsecondsPerPixel(1.70);
print "InsertWCS " . $SX->ccdsoftCameraImage->InsertWCS() . "\n";;
print " InsertWCS Error: " . $SX->getError() . "\n";
print " Image Width: " . $SX->ccdsoftCameraImage->Width . "\n";
print " Image Height: " . $SX->ccdsoftCameraImage->Height . "\n";
# print " Image JulianDay: " . $SX->ccdsoftCameraImage->JulianDay . "\n";
print " Image ModifiedFlag: " . $SX->ccdsoftCameraImage->ModifiedFlag . "\n";
$SX->ccdsoftCameraImage->Save();
print "Finished testing ccdsoftCameraImage module.\n";
sleep 1;
}
( run in 3.083 seconds using v1.01-cache-2.11-cpan-98e64b0badf )