Example #1
0
def spec_url(request, url):
    validate = URLValidator()
    
    try:
        validate(url)
        # TODO: download url to tempfile
    except ValidationError:
        if media_root is None:
            raise NoNMRDataError('The path supplied has no NMR spectra: %s' %url)
            
        abs_url = os.path.abspath(os.path.join(media_root, url))
        if abs_url[:len(media_root)] != media_root:
            raise NoNMRDataError('Permission denied to access this url: %s' %url)
    
    specs = fromFile(abs_url)
    if isinstance(specs, NMRSpectrum):
        specs = [specs]
    registerSpecs(request, specs)
    return specs
Example #2
0
 def setUp(self):
     spec1d = fromFile('./test_files/Bruker_1D/', 'Bruker')
     self.spec1d = spec1d
     self.fid_file = './test_files/bmse000281_hsqc.fid'
Example #3
0
 def setUp(self):
     spec1d = fromFile('./test_files/Bruker_1D/', 'Bruker')
     ds = NMRDataset(1, spec1d, spec1d, spec1d)
     self.ds = ds
     self.spec1d = spec1d
     self.fid_file = './test_files/bmse000281_hsqc.fid'
Example #4
0
 def setUp(self):
     spec1d = fromFile('./test_files/Bruker_1D/', 'Bruker')
     self.spec1d = spec1d
     self.fid_file = './test_files/bmse000281_hsqc.fid'
Example #5
0
 def setUp(self):
     spec1d = fromFile('./test_files/Bruker_1D/', 'Bruker')
     ds = NMRDataset(1, spec1d, spec1d, spec1d)
     self.ds = ds
     self.spec1d = spec1d
     self.fid_file = './test_files/bmse000281_hsqc.fid'
Example #6
0
def coffees_test(request):
    import os.path
    abs_url = os.path.join(os.path.dirname(__file__), 'static/nmrpro/demo.tar.gz')
    specs = fromFile(abs_url)
    registerSpecs(request, specs)
    return specs