<commit_before>// Copyright (C) 1999-2018
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"

#include "context.h"
#include "framebase.h"
#include "fitsimage.h"

double Base::mapAngleFromRef(double angle, Coord::CoordSystem sys, 
			     Coord::SkyFrame sky)
{
  double rr = angle;
  FitsImage* ptr = currentContext->cfits;
  if (!ptr)
    return 0;

  switch (sys) {
  case Coord::IMAGE: 
  case Coord::PHYSICAL:
  case Coord::DETECTOR:
  case Coord::AMPLIFIER:
    break;
  default:
    if (hasWCSCel(sys))
      rr += ptr->getWCSRotation(sys,sky);
    else {
      Coord::Orientation oo = keyContext->fits->getWCSOrientation(sys, sky);
      if (oo==Coord::XX) {
	rr = -(angle + ptr->getWCSRotation(sys,sky) + M_PI);
      }
    }    
    break;
  }

  return zeroTWOPI(rr);
}

double Base::mapAngleToRef(double angle, Coord::CoordSystem sys, 
			   Coord::SkyFrame sky)
{
  double rr = angle;
  FitsImage* ptr = currentContext->cfits;
  if (!ptr)
    return 0;

  switch (sys) {
  case Coord::IMAGE: 
  case Coord::PHYSICAL:
  case Coord::DETECTOR:
  case Coord::AMPLIFIER:
    break;
  default:
    if (hasWCSCel(sys))
      rr -= ptr->getWCSRotation(sys,sky);
    else {
      Coord::Orientation oo = keyContext->fits->getWCSOrientation(sys, sky);
      if (oo==Coord::XX) {
	rr = -(angle + ptr->getWCSRotation(sys,sky) + M_PI);
      }
    }    
    break;
  }

  return zeroTWOPI(rr);
}

Vector FrameBase::mapFromRef(const Vector& vv, Coord::InternalSystem sys)
{<commit_msg>fix issue with rotation angle wcs which is flipx<commit_after>// Copyright (C) 1999-2018
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"

#include "context.h"
#include "framebase.h"
#include "fitsimage.h"

double Base::mapAngleFromRef(double angle, Coord::CoordSystem sys, 
			     Coord::SkyFrame sky)
{
  double rr = angle;
  FitsImage* ptr = currentContext->cfits;
  if (!ptr)
    return 0;

  switch (sys) {
  case Coord::IMAGE: 
  case Coord::PHYSICAL:
  case Coord::DETECTOR:
  case Coord::AMPLIFIER:
    break;
  default:
    Coord::Orientation oo = keyContext->fits->getWCSOrientation(sys, sky);
    if (oo==Coord::XX) 
      rr = -(angle + ptr->getWCSRotation(sys,sky) + M_PI);
    else
      rr += ptr->getWCSRotation(sys,sky);
    break;
  }

  return zeroTWOPI(rr);
}

double Base::mapAngleToRef(double angle, Coord::CoordSystem sys, 
			   Coord::SkyFrame sky)
{
  double rr = angle;
  FitsImage* ptr = currentContext->cfits;
  if (!ptr)
    return 0;

  switch (sys) {
  case Coord::IMAGE: 
  case Coord::PHYSICAL:
  case Coord::DETECTOR:
  case Coord::AMPLIFIER:
    break;
  default:
    Coord::Orientation oo = keyContext->fits->getWCSOrientation(sys, sky);
    if (oo==Coord::XX)
      rr = -(angle + ptr->getWCSRotation(sys,sky) + M_PI);
    else
      rr -= ptr->getWCSRotation(sys,sky);
    break;
  }

  return zeroTWOPI(rr);
}

Vector FrameBase::mapFromRef(const Vector& vv, Coord::InternalSystem sys)
{
{'fraction_non_alphanumeric': 0.13656957928802588, 'fraction_numerical': 0.006472491909385114, 'mean_word_length': 3.5455882352941175, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1959103', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1064, 'n_words': 258}