Пример #1
0
void SpinPointSpace::updateAddPeak( Spin* s )
{
	// Dasselbe wie refill, aber nur für einen einzelnen Spin
	if( !d_st.isNull() )
	{
		const bool showLink = d_showLinks && d_noesy != DimUndefined && 
			d_st->getDimCount() > 1;

		ElementSet inf;
		if( d_showInferred || showLink )
			inferPeaks( inf, s->getSystem(), s->getLabel() );

		ElementSet links;
		ElementSet::const_iterator j;
		if( d_showInferred && !showLink )
		{
			for( j = inf.begin(); j != inf.end(); ++j )
				_merge( this, d_res, (*j) );
		}else if( showLink && !d_showInferred )
		{
			fillLinks( inf, links );
			for( j = links.begin(); j != links.end(); ++j )
				_merge( this, d_res, (*j) );
		}else if( showLink && d_showInferred )
		{
			fillLinks( inf, links );
			for( j = inf.begin(); j != inf.end(); ++j )
				links.insert( (*j) );
			for( j = links.begin(); j != links.end(); ++j )
				_merge( this, d_res, (*j) );
		}
	}
}
Пример #2
0
void SpinPointSpace::refill()
{
	d_res.clear();
	if( !d_st.isNull() )
	{
		const bool showLink = d_showLinks && d_noesy != DimUndefined && 
			d_st->getDimCount() > 1;

		ElementSet resTuples;
		if( d_showInferred || showLink )
		{
			const SpinBase::SpinSystemMap& sm = d_spins->getSystems();

			SpinBase::SpinSystemMap::const_iterator sysIter;
			for( sysIter = sm.begin(); sysIter != sm.end(); ++sysIter )
			{
				Element elem;
				SpinSystem* sys = 0;
				if( d_doPathsim )
				{
					sys = (*sysIter).second;
					elem.setInfer(); // nur hier handelt es sich um echte Pfadsimulation; sonst cross-product
				}
				NmrExperiment* e = d_types->inferExperiment2( d_st, sys, d_spec );
//				std::strstream out;
//				e->printTable(out);
//				qDebug() << out.str();
				const PathTable& tbl = e->getTable();
				PathTable::Table::const_iterator rowIter;
				for( rowIter = tbl.begin(); rowIter != tbl.end(); ++rowIter )
					fillTuples( elem, (*sysIter).second, (*rowIter), resTuples, DimX );
					// fillTuples wird in jedem Fall mit dem System aufgerufen
			}
		}
		ElementSet resLinks;
		ElementSet::const_iterator j;
		if( d_showInferred && !showLink )
		{
			for( j = resTuples.begin(); j != resTuples.end(); ++j )
				d_res.insert( (*j) );
		}else if( showLink && !d_showInferred )
		{
			fillLinks( resTuples, resLinks );
			for( j = resLinks.begin(); j != resLinks.end(); ++j )
				d_res.insert( (*j) );
		}else if( showLink && d_showInferred )
		{
			fillLinks( resTuples, resLinks );
			for( j = resTuples.begin(); j != resTuples.end(); ++j )
				resLinks.insert( (*j) );
			for( j = resLinks.begin(); j != resLinks.end(); ++j )
				d_res.insert( (*j) );
		}
	}
	SpinSpace::Update m( this, SpinSpace::Update::All );
	notifyObservers( m );
}
Пример #3
0
ConstantPropLatticeElement* ConstantPropLattice::join(vector <LatticeElement*>& list_) { 
  ConstantPropLatticeElement* first = static_cast<ConstantPropLatticeElement*>(list_[0]);
  ConstantPropLatticeElement* second = static_cast<ConstantPropLatticeElement*>(list_[1]);

  ElementSet firstElementSet = first->getLatticeElement();
  ElementSet secondElementSet = second->getLatticeElement();
  secondElementSet.insert(firstElementSet.begin(), firstElementSet.end());

  return new ConstantPropLatticeElement(secondElementSet);
}
Пример #4
0
void SpinPointSpace::fillLinks(const ElementSet& inf, ElementSet& res)
{
#ifdef _DEBUG
	assert( d_st && d_st->getDimCount() > 1 && d_noesy != DimUndefined );
#endif
	// Finde zuerst raus, zwischen welchen Dim es Noesy gibt.
	// Wir gehen hier davon aus, dass immer nur ein Noesy-Step vorhanden ist.
	// 8.3.04 Fred meint, showAll sei nicht nötig und es genüge, die Links
	// auf NOESY zu beschränken.
	// Eigentlich könnte man den NOESY-Step sogar auf den letzten Step beschränken.

	const Dimension dim = d_st->getDimCount();
    const AtomType noesyColor = d_st->getColor( d_noesy );
    for( ElementSet::const_iterator i = inf.begin(); i != inf.end(); ++i )
	{
		// Gehe durch alle Points, die durch Pathsim gefunden wurden
        Element p = (*i);
        for( Dimension d = 0; d < dim; d++ )
		{
			p.reset();
			if( d != d_noesy )
			{
				p.setLink( d, d_noesy );
                Spin* me = p.d_point[ d ];

				// Suche für jeden Pathsim-Point alle Links zur Noesy-Dim
                for( Spin::Links::const_iterator l = me->getLinks().begin();
					l != me->getLinks().end(); ++l )
				{
                    Spin* other;
					if( (*l)->getRhs() != me->getId() )
						other = d_spins->getSpin( (*l)->getRhs() );
					else
						other = d_spins->getSpin( (*l)->getLhs() );
                    if( other && other->getAtom() == noesyColor )
					{
						if( d_showInferred )
							// Trick, damit die intraresiduellen infered bleiben.
							p.setInfer( me->getSystem() == other->getSystem() );
						p.d_point[ d_noesy ] = other;
						res.insert( p );
					}
				}
			}
		}
	}
}
Пример #5
0
void SpinPointSpace::fillTuples( Element& elem, SpinSystem* sys,
						  const PathTable::Path& path, ElementSet& res, Dimension dim )
{
	Q_ASSERT( d_st != 0 );
	Q_ASSERT( sys != 0 );
	// Wandert entlang den Anchor-Dimensions und fügt zuletzt das Tuple ein,
	// wenn man überhaupt soweit kommt. Implizit findet auch eine 
	// Multiplikation über alle non-final-Kombinationen statt.

	SpinSystem::Spins spins;
	const SpinLabel& label = path[ dim ];
	if( false ) // dim == d_noesy ) // ab CARA 1.9.1 werden alle NOESY von NmrExperiment explizit in Atome aufgelöst
	{
		spins = sys->findNoesySpins( d_st->getColor( dim ), d_showNulls, d_showOffs );
		// Dieser Schritt holt sich einfach alle Spins der gegebenen Atomfarbe aus dem System, unabhängig
		// vom SystemType bzw. ResidueType des Systems.
	}else
	{
		spins = sys->findSpins( label.getTag(), label.getOff(), d_st->getColor( dim ),
							d_showNulls, d_showOffs, d_showUnknown );
			// Es werden auch non-finals verwendet. 
			// Diese müssen zumindest im Label übereinstimmen
		if( label.getTag().isNull() )
			elem.setInfer(false); // In diesem Fall hat findSpins ein cross-product gemacht; das
								  // kommt nur vor, wenn ResiType nicht bekannt oder SpecType keine Proc hat.
	}
//	QStringList tmp; // TEST
//	for( SpinSystem::Spins::const_iterator i = spins.begin(); i != spins.end(); ++i )
//		tmp << (*i)->getLabel().getTag().data();
//	qDebug() << dim << label.getTag().data() << d_st->getColor( dim ).getAtomLabel() << tmp;
	const Dimension dmax = d_st->getDimCount();
	SpinSystem::Spins::const_iterator spinIter;
	for( spinIter = spins.begin(); spinIter != spins.end(); ++spinIter )
	{
		elem.d_point[ dim ] = (*spinIter);
		if( dim < dmax - 1 )
			fillTuples( elem, sys, path, res, dim + 1 );
		else
			res.insert( elem );
	}
}
Пример #6
0
void SysFilterSpace::refill()
{
	d_res.clear();

    if( d_sys )
    {
        ElementSet res;
        SpinSpace::Iterator i, _end = d_host->end();
        SpinSpace::Element e;
        for( i = d_host->begin(); i != _end; ++i )
        {
            d_host->fetch( i, e );
            e.setHigher();
            e.setLower();
            bool ok = false;
            const Dimension dim = d_host->getDimCount();
            for( Dimension d = 0; d < dim; d++ )
            {
                if( e.d_point[ d ]->getSystem() == d_sys )
                {
                    e.setHigher( false );
                    e.setLower( false );
                    ok = true;
                    break;
                }
            }
            if( d_showGhosts )
                ok = true;
            if( ok )
                res.insert( e );
        }
        ElementSet::const_iterator j;
        for( j = res.begin(); j != res.end(); ++j )
            d_res.insert( (*j) );
    }
    SpinSpace::Update m( this, SpinSpace::Update::All );
    notifyObservers( m );
}
Пример #7
0
void RangeFilterSpace::refill()
{
	d_res.clear();

	ElementSet res;
	const Dimension dim = d_host->getDimCount();
	if( d_dim >= DimX && d_dim < dim )
	{
		SpinSpace::Iterator i, _end = d_host->end();
		SpinSpace::Element e;
		PpmRange inner( d_orig + d_width * 0.5, d_orig - d_width * 0.5 );
		PpmRange outer = inner;
		if( d_showGhosts && d_planes > 0.0 )
			outer.expand( d_planes - d_width );
		bool ok;
		bool ghost;
		PPM shift;
		Dimension d;
		for( i = d_host->begin(); i != _end; ++i )
		{
			d_host->fetch( i, e );
			shift = e.d_point[ d_dim ]->getShift( d_host->getSpec() );
			e.setHigher();
			e.setLower();
			ghost = true;
			if( inner.contains( shift ) )
			{
				ok = true;
				ghost = false;
			}else if( d_showGhosts && outer.contains( shift ) )
			{
				if( shift > inner.first )
					e.setLower( false );
				if( shift < inner.second )
					e.setHigher( false );
				ok = true;
			}else
				ok = false;
			if( d_sys && ok )
			{ 
				ok = false;
				for( d = 0; d < dim; d++ )
				{
					if( e.d_point[ d ]->getSystem() == d_sys )
					{
						e.setHigher( false );
						e.setLower( false );
						ok = true;
						break;
					}
				}
				if( d_showGhosts )
					ok = true;
			}else if( ok && !ghost )
			{
				e.setHigher( false );
				e.setLower( false );
			}
			if( ok )
				res.insert( e );
		}
	}
	ElementSet::const_iterator j;
	for( j = res.begin(); j != res.end(); ++j )
		d_res.insert( (*j) );
	SpinSpace::Update m( this, SpinSpace::Update::All );
	notifyObservers( m );
}