5 #if QT_VERSION >= 0x050000
13 m_TwoTheta(QcepSettingsSaverWPtr(), this,
"twoTheta",
"",
"twoTheta spec"),
14 m_TwoThetaCorrection(QcepSettingsSaverWPtr(), this,
"twoThetaCorrection", 0.0,
"twoTheta correction"),
15 m_TwoThetaNom(QcepSettingsSaverWPtr(), this,
"twoThetaNom", 0.0,
"twoTheta nominal (start)"),
16 m_TwoThetaStep(QcepSettingsSaverWPtr(), this,
"twoThetaStep", 0.0,
"twoTheta step"),
17 m_TwoThetaAngles(QcepSettingsSaverWPtr(), this,
"twoThetaAngles", QcepDoubleVector(),
"twoTheta Angles"),
19 m_Omega(QcepSettingsSaverWPtr(), this,
"omega",
"",
"omega spec"),
20 m_OmegaCorrection(QcepSettingsSaverWPtr(), this,
"omegaCorrection", 0.0,
"omega correction"),
21 m_OmegaNom(QcepSettingsSaverWPtr(), this,
"omegaNom", 0.0,
"omega nominal (start)"),
22 m_OmegaStep(QcepSettingsSaverWPtr(), this,
"omegaStep", 0.0,
"omega step"),
23 m_OmegaAngles(QcepSettingsSaverWPtr(), this,
"omegaAngles", QcepDoubleVector(),
"omega Angles"),
25 m_Chi(QcepSettingsSaverWPtr(), this,
"chi",
"",
"chi spec"),
26 m_ChiCorrection(QcepSettingsSaverWPtr(), this,
"chiCorrection", 0.0,
"chi correction"),
27 m_ChiNom(QcepSettingsSaverWPtr(), this,
"chiNom", 0.0,
"chi nominal (start)"),
28 m_ChiStep(QcepSettingsSaverWPtr(), this,
"chiStep", 0.0,
"chi step"),
29 m_ChiAngles(QcepSettingsSaverWPtr(), this,
"chiAngles", QcepDoubleVector(),
"chi Angles"),
31 m_Phi(QcepSettingsSaverWPtr(), this,
"phi",
"",
"phi spec"),
32 m_PhiCorrection(QcepSettingsSaverWPtr(), this,
"phiCorrection", 0.0,
"phi correction"),
33 m_PhiNom(QcepSettingsSaverWPtr(), this,
"phiNom", 0.0,
"phi nominal (start)"),
34 m_PhiStep(QcepSettingsSaverWPtr(), this,
"phiStep", 0.0,
"phi step"),
35 m_PhiAngles(QcepSettingsSaverWPtr(), this,
"phiAngles", QcepDoubleVector(),
"phi Angles"),
37 m_ExtraFlip(QcepSettingsSaverWPtr(), this,
"extraFlip", 1,
"Extra Flip on input x->(2048-y), y->(2048-x)")
51 -0.247516, -0.000885, 0.001892,
52 0.000736, 0.172899, 0.177127));
125 parseAngleArgument(tth,
"twoTheta", &m_TwoThetaCorrection, &m_TwoThetaNom, &m_TwoThetaStep, &m_TwoThetaAngles);
130 return interpolateAngle(frame, &m_TwoThetaCorrection, &m_TwoThetaNom, &m_TwoThetaStep, &m_TwoThetaAngles);
136 parseAngleArgument(omg,
"omega", &m_OmegaCorrection, &m_OmegaNom, &m_OmegaStep, &m_OmegaAngles);
141 return interpolateAngle(frame, &m_OmegaCorrection, &m_OmegaNom, &m_OmegaStep, &m_OmegaAngles);
147 parseAngleArgument(chi,
"chi", &m_ChiCorrection, &m_ChiNom, &m_ChiStep, &m_ChiAngles);
152 return interpolateAngle(frame, &m_ChiCorrection, &m_ChiNom, &m_ChiStep, prop_ChiAngles());
158 parseAngleArgument(phi,
"phi", &m_PhiCorrection, &m_PhiNom, &m_PhiStep, &m_PhiAngles);
163 return interpolateAngle(frame, &m_PhiCorrection, &m_PhiNom, &m_PhiStep, &m_PhiAngles);
175 const QString angleName,
176 QcepDoubleProperty *corr,
177 QcepDoubleProperty *start,
178 QcepDoubleProperty *step,
179 QcepDoubleVectorProperty *angs)
182 QString fileName =
"";
183 QString dataSetName =
"";
188 if (qcepDebug(DEBUG_APP)) {
195 #if QT_VERSION >= 0x050000
201 #if QT_VERSION >= 0x050000
202 if (url.hasQuery()) {
205 QList <QPair <QString, QString> > l = qry.queryItems();
207 QPair<QString, QString> v;
209 if (qcepDebug(DEBUG_APP)) {
215 if (qry.hasQueryItem(
"start") && start) {
216 QString chunkSize = qry.queryItemValue(
"start");
218 start->setValue(chunkSize.toDouble());
219 printMessage(tr(
"%1 start at %2").arg(angleName).arg(start->value()));
222 if (qry.hasQueryItem(
"nom") && start) {
223 QString s = qry.queryItemValue(
"nom");
225 start->setValue(s.toDouble());
226 printMessage(tr(
"%1 start At %2").arg(angleName).arg(start->value()));
229 if (qry.hasQueryItem(
"step") && step) {
230 QString s = qry.queryItemValue(
"step");
232 step->setValue(s.toDouble());
233 printMessage(tr(
"%1 step by %2").arg(angleName).arg(step->value()));
239 QRegExp n1(
"[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?");
240 QRegExp n2(
"([-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?),([-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?)");
242 if (n1.exactMatch(arg)) {
244 start->setValue(arg.toDouble());
245 printMessage(tr(
"%1 angle = %2").arg(angleName).arg(start->value()));
247 }
else if (n2.exactMatch(arg)) {
248 if (qcepDebug(DEBUG_APP)) {
249 printMessage(tr(
"Matched two numbers : count %1").arg(n2.captureCount()));
251 if (start && n2.captureCount()==2) {
252 start->setValue(n2.cap(1).toDouble());
253 printMessage(tr(
"%1 start at %2").arg(angleName).arg(start->value()));
255 if (step && n2.captureCount()==2) {
256 step->setValue(n2.cap(2).toDouble());
257 printMessage(tr(
"%1 step by %2").arg(angleName).arg(step->value()));
259 }
else if (url.path().length() >= 1){
260 fileName = url.path();
261 dataSetName = url.fragment();
263 if (fileName.length() == 0) {
264 printMessage(tr(
"No filename given for %1 angles, skipping").arg(angleName));
267 if (dataSetName.length() == 0) {
268 printMessage(tr(
"No dataset name given for %1 angles, skipping").arg(angleName));
271 QFileInfo f(fileName);
280 throw tr(
"%1 angles file %2 does not exist").arg(angleName).arg(fileName);
282 if (H5Fis_hdf5(qPrintable(fileName)) <= 0)
283 throw tr(
"%1 angles file %2 exists but is not an hdf file").arg(angleName).arg(fileName);
285 fileId = H5Fopen(qPrintable(fileName), H5F_ACC_RDONLY, H5P_DEFAULT);
288 throw tr(
"%1 angles file %2 could not be opened").arg(angleName).arg(fileName);
290 dsetId = H5Dopen(fileId, qPrintable(dataSetName), H5P_DEFAULT);
293 throw tr(
"Could not open %1 angles dataset %2").arg(angleName).arg(dataSetName);
295 dspcId = H5Dget_space(dsetId);
298 throw tr(
"Could not get dataspace of existing %1 angles dataset %2").arg(angleName).arg(dataSetName);
301 int ndims = H5Sget_simple_extent_ndims(dspcId);
304 throw tr(
"%1 angles dataset %2, dataspace is not 1-dimensional").arg(angleName).arg(dataSetName);
306 int ndims2 = H5Sget_simple_extent_dims(dspcId, dims, NULL);
309 throw tr(
"Could not get %1 angles dataset %2 dimensions").arg(angleName).arg(dataSetName);
312 throw tr(
"Angles argument not given");
316 hid_t memspace_id = -1;
317 hsize_t offset[1], count[1], stride[1], block[1];
323 double *angles = a.data();
325 memspace_id = H5Screate_simple(1, count, NULL);
327 herr_t selerr = H5Sselect_hyperslab(dspcId, H5S_SELECT_SET, offset, stride, count, block);
330 throw tr(
"Error selecting hyperslab for %1 failed, selerr = %2").arg(angleName).arg(selerr);
332 herr_t rderr = H5Dread(dsetId,
335 dspcId, H5P_DEFAULT, angles);
338 throw tr(
"Error reading %1 angles, rderr = %2").arg(angleName).arg(rderr);
350 if (dspcId >= 0) H5Sclose(dspcId);
351 if (dsetId >= 0) H5Dclose(dsetId);
352 if (fileId >= 0) H5Fclose(fileId);
357 QcepDoubleProperty *corr,
358 QcepDoubleProperty *start,
359 QcepDoubleProperty *step,
360 QcepDoubleVectorProperty *angs)
366 if (angs) a=angs->value();
368 if (a.length() == 0) {
369 res = start->value() + frame*step->value() + corr->value();
371 int f0 = ::floor(frame);
373 double df = frame-f0;
375 res = corr->value() + a.value(f0)+df*(a.value(f1) - a.value(f0));
CctwDoubleVector3D m_OVec
CctwDoubleVector3D m_GridOrigin
CctwDoubleVector3D gridOrigin() const
void setUBMat(CctwDoubleMatrix3x3 ub)
static QString addSlashes(QString str)
void setOMat(CctwDoubleMatrix3x3 om)
void setOrientErrorDetYaw(double x)
void setTwoTheta(const QString tth)
void setGridOrigin(CctwDoubleVector3D org)
void setDet0y(double d0y)
CctwDoubleVector3D gridDim() const
CctwDoubleMatrix3x3 oMat() const
double twoThetaAngle(double frame)
double interpolateAngle(double frame, QcepDoubleProperty *corr, QcepDoubleProperty *start, QcepDoubleProperty *step, QcepDoubleVectorProperty *angs)
void setDistance(double d)
void setOrientErrorDetPitch(double x)
void setOmega(const QString omg)
CctwDoubleVector3D oVec() const
CctwCrystalCoordinateParameters(QString name, QObject *parent)
double orientErrorDetYaw() const
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
void setOrientErrorDetRoll(double x)
void setGridBasis(CctwDoubleMatrix3x3 bas)
CctwDoubleVector3D m_GridOffset
double m_OrientErrorDetPitch
double m_OrientErrorDetYaw
void setUnitCell(CctwUnitCell uc)
CctwDoubleVector3D m_GridDim
CctwDoubleVector3D xTrans() const
void parseAngleArgument(const QString arg, const QString angleName, QcepDoubleProperty *corr, QcepDoubleProperty *start, QcepDoubleProperty *step, QcepDoubleVectorProperty *angs)
CctwUnitCell unitCell() const
void setDet0x(double d0x)
double wavelength() const
CctwDoubleMatrix3x3 m_GridBasis
double chiAngle(double frame)
double omegaAngle(double frame)
void setXTrans(CctwDoubleVector3D xt)
void setPhi(const QString phi)
double phiAngle(double frame)
CctwDoubleMatrix3x3 ubMat() const
CctwDoubleMatrix3x3 m_OMat
void setGridOffset(CctwDoubleVector3D off)
void setPixelSize(double sz)
double orientErrorDetPitch() const
CctwMatrix3x3< double > CctwDoubleMatrix3x3
void setWavelength(double wv)
void setGridDim(CctwDoubleVector3D dim)
double m_OrientErrorGonPitch
CctwDoubleVector3D gridOffset() const
CctwDoubleMatrix3x3 m_UBMat
void setOrientErrorGonPitch(double x)
double m_OrientErrorDetRoll
CctwDoubleVector3D m_XTrans
CctwDoubleMatrix3x3 gridBasis() const
CctwVector3D< double > CctwDoubleVector3D
double orientErrorDetRoll() const
double orientErrorGonPitch() const
void setOVec(CctwDoubleVector3D ov)
void setChi(const QString chi)