void FitsFile::ReadGroup(long groupIndex, long double *groupData)
{
	int status = 0;
	long size = GetImageSize();
	long pSize = GetParameterCount();
	double *parameters = new double[pSize];
	double nulValue = std::numeric_limits<double>::quiet_NaN();
	int anynul = 0;

	fits_read_grppar_dbl(_fptr, groupIndex+1, 1, pSize, parameters, &status);
	CheckStatus(status);

	for(long i = 0; i<pSize;++i)
		groupData[i] = parameters[i];

	delete[] parameters;
	double *data = new double[size];

	fits_read_img_dbl(_fptr, groupIndex+1, 1, size, nulValue, data, &anynul, &status);
	CheckStatus(status);

	for(long i = 0; i<size; ++i)
		groupData[pSize + i] = data[i];

	delete[] data;

	if(anynul != 0)
		Logger::Warn << "There were nulls in the group\n";
}
void FitsFile::ReadGroupParameters(long groupIndex, long double *parametersData)
{
	int status = 0;
	long pSize = GetParameterCount();
	double *parameters = new double[pSize];

	fits_read_grppar_dbl(_fptr, groupIndex+1, 1, pSize, parameters, &status);
	CheckStatus(status);

	for(long i = 0; i<pSize;++i)
		parametersData[i] = parameters[i];

	delete[] parameters;
}
Exemple #3
0
int get_sample(fitsfile *fptr, struct uvf_header *header,
	       int number, struct uvf_sample *sample)
{
  int status = 0, k;
  double pdata[MAX_PAR];

  /* Read the random parameters */
  fits_read_grppar_dbl(fptr, number, 1, header->pcount, pdata, &status);

  /* Read the visibility data */
  fits_read_img_flt(fptr, number, 1, 3*(header->nchan),
		    0.0, sample->rdata, NULL, &status);

  /* Interpret the random parameters */
  k = header->index_u;
  if (k >= 0)
    sample->u = pdata[k]*header->pscal[k] + header->pzero[k];
  k = header->index_v;
  if (k >= 0)
    sample->v = pdata[k]*header->pscal[k] + header->pzero[k];
  k = header->index_w;
  if (k >= 0)
    sample->w = pdata[k]*header->pscal[k] + header->pzero[k];
  k = header->index_baseline;
  if (k >= 0)
    sample->baseline = pdata[k]*header->pscal[k] + header->pzero[k];
  sample->date = -2400000.5;
  k = header->index_date1;
  if (k >= 0)
    sample->date += pdata[k]*header->pscal[k] + header->pzero[k];
  k = header->index_date2;
  if (k >= 0)
    sample->date += pdata[k]*header->pscal[k] + header->pzero[k];
  k = header->index_inttim;
  if (k >= 0)
    sample->inttim = pdata[k]*header->pscal[k] + header->pzero[k];
  return status ? 1 : 0;
}