Author: bugman Date: Fri May 24 09:39:06 2013 New Revision: 19724 URL: http://svn.gna.org/viewcvs/relax?rev=19724&view=rev Log: Renamed the functions of the pipe_control.spectrometer module. The frequency() and temperature() functions are now called set_frequency() and set_temperature(). Modified: trunk/pipe_control/spectrometer.py trunk/user_functions/spectrometer.py Modified: trunk/pipe_control/spectrometer.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/spectrometer.py?rev=19724&r1=19723&r2=19724&view=diff ============================================================================== --- trunk/pipe_control/spectrometer.py (original) +++ trunk/pipe_control/spectrometer.py Fri May 24 09:39:06 2013 @@ -33,7 +33,50 @@ from pipe_control import pipes -def frequency(id=None, frq=None, units='Hz'): +def get_frequencies(units='Hz'): + """Return a list of all the current spectrometer frequencies. + + The returned values can be changed with the units argument which can have the following values: + + - 'Hz' will return the proton frequency (wH), + - 'MHz' will return the proton frequency in megahertz, + - 'T' will return the B0 field in Tesla. + + + @keyword units: The magnetic field units to return. This can be one of 'Hz', 'MHz', or 'T'. + @type units: str + @return: The frequency list for the current data pipe. + @rtype: list of float + """ + + # No frequency data. + if not hasattr(cdp, 'spectrometer_frq'): + return [] + + # Convert the values. + frq = [] + for value in cdp.spectrometer_frq_list: + # Hertz. + if units == 'Hz': + frq.append(value) + + # MHz. + elif units == 'MHz': + frq.append(value * 1e-6) + + # Tesla. + elif unit == 'T': + frq.append(value * 2.0 * pi / g1H) + + # Unknown units. + else: + raise RelaxError("The units of '%s' should be one of 'Hz', 'MHz', or 'T'.") + + # Return the frqs. + return frq + + +def set_frequency(id=None, frq=None, units='Hz'): """Set the spectrometer frequency of the experiment. @keyword id: The experimental identification string (allowing for multiple experiments per data pipe). @@ -84,50 +127,7 @@ cdp.spectrometer_frq_count += 1 -def get_frequencies(units='Hz'): - """Return a list of all the current spectrometer frequencies. - - The returned values can be changed with the units argument which can have the following values: - - - 'Hz' will return the proton frequency (wH), - - 'MHz' will return the proton frequency in megahertz, - - 'T' will return the B0 field in Tesla. - - - @keyword units: The magnetic field units to return. This can be one of 'Hz', 'MHz', or 'T'. - @type units: str - @return: The frequency list for the current data pipe. - @rtype: list of float - """ - - # No frequency data. - if not hasattr(cdp, 'spectrometer_frq'): - return [] - - # Convert the values. - frq = [] - for value in cdp.spectrometer_frq_list: - # Hertz. - if units == 'Hz': - frq.append(value) - - # MHz. - elif units == 'MHz': - frq.append(value * 1e-6) - - # Tesla. - elif unit == 'T': - frq.append(value * 2.0 * pi / g1H) - - # Unknown units. - else: - raise RelaxError("The units of '%s' should be one of 'Hz', 'MHz', or 'T'.") - - # Return the frqs. - return frq - - -def temperature(id=None, temp=None): +def set_temperature(id=None, temp=None): """Set the experimental temperature. @keyword id: The experimental identification string (allowing for multiple experiments per data pipe). Modified: trunk/user_functions/spectrometer.py URL: http://svn.gna.org/viewcvs/relax/trunk/user_functions/spectrometer.py?rev=19724&r1=19723&r2=19724&view=diff ============================================================================== --- trunk/user_functions/spectrometer.py (original) +++ trunk/user_functions/spectrometer.py Fri May 24 09:39:06 2013 @@ -72,7 +72,7 @@ # Description. uf.desc.append(Desc_container()) uf.desc[-1].add_paragraph("This allows the spectrometer frequency of a given experiment to be set. The expected units are that of the proton resonance frequency in Hertz. See the 'sfrq' parameter in the Varian procpar file or the 'SFO1' parameter in the Bruker acqus file for the exact value.") -uf.backend = pipe_control.spectrometer.frequency +uf.backend = pipe_control.spectrometer.set_frequency uf.menu_text = "&frequency" uf.gui_icon = "relax.frq" uf.wizard_size = (750, 500) @@ -98,7 +98,7 @@ # Description. uf.desc.append(Desc_container()) uf.desc[-1].add_paragraph("This allows the temperature of an experiment to be set. This value should be in Kalvin. In certain analyses, for example those which use pseudocontact shift data, knowledge of the temperature is essential. For the pseudocontact shift, the experiment ID string should match one of the alignment IDs.") -uf.backend = pipe_control.spectrometer.temperature +uf.backend = pipe_control.spectrometer.set_temperature uf.menu_text = "&temperature" uf.gui_icon = "oxygen.status.weather-clear" uf.wizard_size = (700, 500)