Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/align/align.cpp
Show First 20 Lines • Show All 2469 Lines • ▼ Show 20 Line(s) | 2455 | { | |||
---|---|---|---|---|---|
2470 | // fits2fits | 2470 | // fits2fits | ||
2471 | if (optionsMap.contains("nofits2fits")) | 2471 | if (optionsMap.contains("nofits2fits")) | ||
2472 | solver_args << "--no-fits2fits"; | 2472 | solver_args << "--no-fits2fits"; | ||
2473 | 2473 | | |||
2474 | // downsample | 2474 | // downsample | ||
2475 | if (optionsMap.contains("downsample")) | 2475 | if (optionsMap.contains("downsample")) | ||
2476 | solver_args << "--downsample" << QString::number(optionsMap.value("downsample", 2).toInt()); | 2476 | solver_args << "--downsample" << QString::number(optionsMap.value("downsample", 2).toInt()); | ||
2477 | 2477 | | |||
2478 | if(Options::useSextractor()) | ||||
2479 | { | ||||
2480 | qDebug()<<"Is there an image width"; | ||||
mutlaqja: is this still required? | |||||
2481 | if (optionsMap.contains("image_width")) | ||||
2482 | qDebug()<<"Yes there is: " << QString::number(optionsMap.value("image_width").toInt()); | ||||
2483 | else | ||||
2484 | qDebug()<<"no not really"; | ||||
2485 | //Sextractor needs all these parameters in order to solve an xylist of stars | ||||
2486 | if (optionsMap.contains("image_width")) | ||||
2487 | solver_args << "--width" << QString::number(optionsMap.value("image_width").toInt()); | ||||
2488 | if (optionsMap.contains("image_height")) | ||||
2489 | solver_args << "--height" << QString::number(optionsMap.value("image_height").toInt()); | ||||
2490 | solver_args << "--x-column X_IMAGE --y-column Y_IMAGE --sort-column MAG_AUTO --sort-ascending"; | ||||
2491 | | ||||
2492 | //Note This set of items is NOT NEEDED for Sextractor, it is needed to avoid python usage | ||||
2493 | //This may need to be changed later, but since the goal for using sextractor is to avoid python, this is placed here. | ||||
2494 | solver_args << "--no-remove-lines --uniformize 0"; | ||||
2495 | } | ||||
2496 | | ||||
2478 | // image scale low | 2497 | // image scale low | ||
2479 | if (optionsMap.contains("scaleL")) | 2498 | if (optionsMap.contains("scaleL")) | ||
2480 | solver_args << "-L" << QString::number(optionsMap.value("scaleL").toDouble()); | 2499 | solver_args << "-L" << QString::number(optionsMap.value("scaleL").toDouble()); | ||
2481 | 2500 | | |||
2482 | // image scale high | 2501 | // image scale high | ||
2483 | if (optionsMap.contains("scaleH")) | 2502 | if (optionsMap.contains("scaleH")) | ||
2484 | solver_args << "-H" << QString::number(optionsMap.value("scaleH").toDouble()); | 2503 | solver_args << "-H" << QString::number(optionsMap.value("scaleH").toDouble()); | ||
2485 | 2504 | | |||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 2597 | { | |||
2579 | uint8_t bin = qMax(Options::solverBinningIndex() + 1, 1u); | 2598 | uint8_t bin = qMax(Options::solverBinningIndex() + 1, 1u); | ||
2580 | uint16_t w = ccd_width / bin; | 2599 | uint16_t w = ccd_width / bin; | ||
2581 | optionsMap["downsample"] = getSolverDownsample(w); | 2600 | optionsMap["downsample"] = getSolverDownsample(w); | ||
2582 | } | 2601 | } | ||
2583 | else | 2602 | else | ||
2584 | optionsMap["downsample"] = Options::astrometryDownsample(); | 2603 | optionsMap["downsample"] = Options::astrometryDownsample(); | ||
2585 | } | 2604 | } | ||
2586 | 2605 | | |||
2606 | //Options needed for Sextractor | ||||
2607 | int bin = Options::solverBinningIndex() + 1; | ||||
2608 | optionsMap["image_width"] = ccd_width / bin; | ||||
2609 | optionsMap["image_height"] = ccd_height / bin; | ||||
2610 | | ||||
2587 | if (Options::astrometryUseImageScale() && fov_x > 0 && fov_y > 0) | 2611 | if (Options::astrometryUseImageScale() && fov_x > 0 && fov_y > 0) | ||
2588 | { | 2612 | { | ||
2589 | QString units = ImageScales[Options::astrometryImageScaleUnits()]; | 2613 | QString units = ImageScales[Options::astrometryImageScaleUnits()]; | ||
2590 | if (Options::astrometryAutoUpdateImageScale()) | 2614 | if (Options::astrometryAutoUpdateImageScale()) | ||
2591 | { | 2615 | { | ||
2592 | QString fov_low, fov_high; | 2616 | QString fov_low, fov_high; | ||
2593 | double fov_w = fov_x; | 2617 | double fov_w = fov_x; | ||
2594 | double fov_h = fov_y; | 2618 | double fov_h = fov_y; | ||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | |||||
2656 | bool Align::captureAndSolve() | 2680 | bool Align::captureAndSolve() | ||
2657 | { | 2681 | { | ||
2658 | m_AlignTimer.stop(); | 2682 | m_AlignTimer.stop(); | ||
2659 | m_CaptureTimer.stop(); | 2683 | m_CaptureTimer.stop(); | ||
2660 | 2684 | | |||
2661 | #ifdef Q_OS_OSX | 2685 | #ifdef Q_OS_OSX | ||
2662 | if(solverBackendGroup->checkedId() == SOLVER_OFFLINE) | 2686 | if(solverBackendGroup->checkedId() == SOLVER_OFFLINE) | ||
2663 | { | 2687 | { | ||
2688 | if(!Options::useSextractor()) | ||||
2689 | { | ||||
2664 | if(Options::useDefaultPython()) | 2690 | if(Options::useDefaultPython()) | ||
2665 | { | 2691 | { | ||
2666 | if( !opsAlign->astropyInstalled() || !opsAlign->pythonInstalled() ) | 2692 | if( !opsAlign->astropyInstalled() || !opsAlign->pythonInstalled() ) | ||
2667 | { | 2693 | { | ||
2668 | KSNotification::error(i18n("Astrometry.net uses python3 and the astropy package for plate solving images offline. These were not detected on your system. Please go into the Align Options and either click the setup button to install them or uncheck the default button and enter the path to python3 on your system and manually install astropy.")); | 2694 | KSNotification::error(i18n("Astrometry.net uses python3 and the astropy package for plate solving images offline. These were not detected on your system. Please go into the Align Options and either click the setup button to install them or uncheck the default button and enter the path to python3 on your system and manually install astropy.")); | ||
2669 | return false; | 2695 | return false; | ||
2670 | } | 2696 | } | ||
2671 | } | 2697 | } | ||
2672 | } | 2698 | } | ||
2699 | } | ||||
2673 | #endif | 2700 | #endif | ||
2674 | 2701 | | |||
2675 | if (currentCCD == nullptr) | 2702 | if (currentCCD == nullptr) | ||
2676 | return false; | 2703 | return false; | ||
2677 | 2704 | | |||
2678 | if (currentCCD->isConnected() == false) | 2705 | if (currentCCD->isConnected() == false) | ||
2679 | { | 2706 | { | ||
2680 | appendLogText(i18n("Error: lost connection to CCD.")); | 2707 | appendLogText(i18n("Error: lost connection to CCD.")); | ||
▲ Show 20 Lines • Show All 395 Lines • ▼ Show 20 Line(s) | 3102 | if (Options::astrometryUseResort()) | |||
3076 | optionsMap["resort"] = true; | 3103 | optionsMap["resort"] = true; | ||
3077 | 3104 | | |||
3078 | if (Options::astrometryUseNoFITS2FITS()) | 3105 | if (Options::astrometryUseNoFITS2FITS()) | ||
3079 | optionsMap["nofits2fits"] = true; | 3106 | optionsMap["nofits2fits"] = true; | ||
3080 | 3107 | | |||
3081 | if (Options::astrometryUseDownsample()) | 3108 | if (Options::astrometryUseDownsample()) | ||
3082 | optionsMap["downsample"] = Options::astrometryDownsample(); | 3109 | optionsMap["downsample"] = Options::astrometryDownsample(); | ||
3083 | 3110 | | |||
3111 | //Options needed for Sextractor | ||||
3112 | int bin = Options::solverBinningIndex() + 1; | ||||
3113 | optionsMap["image_width"] = ccd_width / bin; | ||||
3114 | optionsMap["image_height"] = ccd_height / bin; | ||||
3115 | | ||||
3084 | solverArgs = generateOptions(optionsMap, solverBackendGroup->checkedId()); | 3116 | solverArgs = generateOptions(optionsMap, solverBackendGroup->checkedId()); | ||
3085 | } | 3117 | } | ||
3086 | else if (rc == KMessageBox::No) | 3118 | else if (rc == KMessageBox::No) | ||
3087 | solverArgs = options.split(' '); | 3119 | solverArgs = options.split(' '); | ||
3088 | else | 3120 | else | ||
3089 | { | 3121 | { | ||
3090 | abort(); | 3122 | abort(); | ||
3091 | return; | 3123 | return; | ||
▲ Show 20 Lines • Show All 1475 Lines • ▼ Show 20 Line(s) | 4596 | dec_str = QString("%1:%2:%3") | |||
4567 | .arg(dec_s.arcsec(), 2, 10, QChar('0')); | 4599 | .arg(dec_s.arcsec(), 2, 10, QChar('0')); | ||
4568 | } | 4600 | } | ||
4569 | 4601 | | |||
4570 | bool Align::loadAndSlew(QString fileURL) | 4602 | bool Align::loadAndSlew(QString fileURL) | ||
4571 | { | 4603 | { | ||
4572 | #ifdef Q_OS_OSX | 4604 | #ifdef Q_OS_OSX | ||
4573 | if(solverBackendGroup->checkedId() == SOLVER_OFFLINE) | 4605 | if(solverBackendGroup->checkedId() == SOLVER_OFFLINE) | ||
4574 | { | 4606 | { | ||
4607 | if(!Options::useSextractor()) | ||||
4608 | { | ||||
4575 | if(Options::useDefaultPython()) | 4609 | if(Options::useDefaultPython()) | ||
4576 | { | 4610 | { | ||
4577 | if( !opsAlign->astropyInstalled() || !opsAlign->pythonInstalled() ) | 4611 | if( !opsAlign->astropyInstalled() || !opsAlign->pythonInstalled() ) | ||
4578 | { | 4612 | { | ||
4579 | KSNotification::error(i18n("Astrometry.net uses python3 and the astropy package for plate solving images offline. These were not detected on your system. Please go into the Align Options and either click the setup button to install them or uncheck the default button and enter the path to python3 on your system and manually install astropy.")); | 4613 | KSNotification::error(i18n("Astrometry.net uses python3 and the astropy package for plate solving images offline. These were not detected on your system. Please go into the Align Options and either click the setup button to install them or uncheck the default button and enter the path to python3 on your system and manually install astropy.")); | ||
4580 | return false; | 4614 | return false; | ||
4581 | } | 4615 | } | ||
4582 | } | 4616 | } | ||
4583 | } | 4617 | } | ||
4618 | } | ||||
4584 | #endif | 4619 | #endif | ||
4585 | 4620 | | |||
4586 | if (fileURL.isEmpty()) | 4621 | if (fileURL.isEmpty()) | ||
4587 | fileURL = QFileDialog::getOpenFileName(KStars::Instance(), i18n("Load Image"), dirPath, | 4622 | fileURL = QFileDialog::getOpenFileName(KStars::Instance(), i18n("Load Image"), dirPath, | ||
4588 | "Images (*.fits *.fit *.jpg *.jpeg)"); | 4623 | "Images (*.fits *.fit *.jpg *.jpeg)"); | ||
4589 | 4624 | | |||
4590 | if (fileURL.isEmpty()) | 4625 | if (fileURL.isEmpty()) | ||
4591 | return false; | 4626 | return false; | ||
▲ Show 20 Lines • Show All 321 Lines • ▼ Show 20 Line(s) | 4864 | { | |||
4913 | 4948 | | |||
4914 | // If we need to auto downsample, let us figure out the scale and regenerate options | 4949 | // If we need to auto downsample, let us figure out the scale and regenerate options | ||
4915 | if (Options::astrometryAutoDownsample()) | 4950 | if (Options::astrometryAutoDownsample()) | ||
4916 | { | 4951 | { | ||
4917 | optionsMap["downsample"] = getSolverDownsample(fits_ccd_width); | 4952 | optionsMap["downsample"] = getSolverDownsample(fits_ccd_width); | ||
4918 | solver_args = generateOptions(optionsMap, SOLVER_ASTROMETRYNET); | 4953 | solver_args = generateOptions(optionsMap, SOLVER_ASTROMETRYNET); | ||
4919 | } | 4954 | } | ||
4920 | 4955 | | |||
4956 | //Needed for Sextractor, let us figure out the image size and regenerate options | ||||
4957 | if(Options::useSextractor()) | ||||
4958 | { | ||||
4959 | optionsMap["image_width"] = fits_ccd_width; | ||||
4960 | optionsMap["image_height"] = fits_ccd_height; | ||||
4961 | solver_args = generateOptions(optionsMap, SOLVER_ASTROMETRYNET); | ||||
4962 | } | ||||
4963 | | ||||
4921 | bool coord_ok = true; | 4964 | bool coord_ok = true; | ||
4922 | 4965 | | |||
4923 | status = 0; | 4966 | status = 0; | ||
4924 | char objectra_str[32]; | 4967 | char objectra_str[32]; | ||
4925 | if (fits_read_key(fptr, TSTRING, "OBJCTRA", objectra_str, comment, &status)) | 4968 | if (fits_read_key(fptr, TSTRING, "OBJCTRA", objectra_str, comment, &status)) | ||
4926 | { | 4969 | { | ||
4927 | if (fits_read_key(fptr, TDOUBLE, "RA", &ra, comment, &status)) | 4970 | if (fits_read_key(fptr, TDOUBLE, "RA", &ra, comment, &status)) | ||
4928 | { | 4971 | { | ||
▲ Show 20 Lines • Show All 1232 Lines • Show Last 20 Lines |
is this still required?