@@ -306,26 +306,6 @@ def stage_data(self, uids):
306306 ))
307307 tbl = self ._json_summary_to_table (json_data , base_url = base_url )
308308
309- # staging_root = BeautifulSoup(data_page.content)
310- # downloadFileURL = staging_root.find('form').attrs['action']
311- # data_list_url = os.path.split(downloadFileURL)[0]
312-
313- # # Old version, unreliable: data_list_url = staging_submission.url
314- # log.debug("Data list URL: {0}".format(data_list_url))
315- # self._staging_log['data_list_url'] = data_list_url
316-
317- # time.sleep(1)
318- # data_list_page = self._request('GET', data_list_url, cache=True)
319- # self._staging_log['data_list_page'] = data_list_page
320- # data_list_page.raise_for_status()
321-
322- # if 'Error' in data_list_page.text:
323- # errormessage = staging_root.find(
324- # 'div', id='errorContent').string.strip()
325- # raise RemoteServiceError(errormessage)
326-
327- # tbl = self._parse_staging_request_page(data_list_page)
328-
329309 return tbl
330310
331311 def _HEADER_data_size (self , files ):
@@ -770,27 +750,6 @@ def _parse_staging_request_page(self, data_list_page):
770750
771751 root = BeautifulSoup (data_list_page .content , 'html5lib' )
772752
773- # for link in root.findAll('a'):
774- # if 'script.sh' in link.text:
775- # download_script_url = urljoin(self.dataarchive_url,
776- # link['href'])
777- # if 'download_script_url' not in locals():
778- # raise RemoteServiceError("No download links were found.")
779-
780- # download_script = self._request('GET', download_script_url,
781- # cache=False)
782- # download_script_target_urls = []
783- # for line in download_script.text.split('\n'):
784- # if line and line.split() and line.split()[0] == 'wget':
785- # download_script_target_urls.append(line.split()[1].strip('"'))
786-
787- # if len(download_script_target_urls) == 0:
788- # raise RemoteServiceError("There was an error parsing the download"
789- # " script; it is empty. "
790- # "You can access the download script "
791- # "directly from this URL: "
792- # "{0}".format(download_script_url))
793-
794753 data_table = root .findAll ('table' , class_ = 'list' , id = 'report' )[0 ]
795754 columns = {'uid' : [], 'URL' : [], 'size' : []}
796755 for tr in data_table .findAll ('tr' ):
@@ -864,28 +823,6 @@ def _parse_staging_request_page(self, data_list_page):
864823 "Please include {0} in a bug report."
865824 .format (self ._staging_log ['data_list_url' ]))
866825
867- # if len(download_script_target_urls) != len(columns['URL']):
868- # log.warn("There was an error parsing the data staging page. "
869- # "The results from the page and the download script "
870- # "differ. You can access the download script directly "
871- # "from this URL: {0}".format(download_script_url))
872- # else:
873- # bad_urls = []
874- # for (rurl,url) in (zip(columns['URL'],
875- # download_script_target_urls)):
876- # if rurl == 'None_Found':
877- # url_uid = os.path.split(url)[-1]
878- # ind = np.where(np.array(columns['uid']) == url_uid)[0][0]
879- # columns['URL'][ind] = url
880- # elif rurl != url:
881- # bad_urls.append((rurl, url))
882- # if bad_urls:
883- # log.warn("There were mismatches between the parsed URLs "
884- # "from the staging page ({0}) and the download "
885- # "script ({1})."
886- # .format(self._staging_log['data_list_url'],
887- # download_script_url))
888-
889826 tbl = Table ([Column (name = k , data = v ) for k , v in iteritems (columns )])
890827
891828 return tbl
@@ -966,50 +903,3 @@ def unique(seq):
966903def filter_printable (s ):
967904 """ extract printable characters from a string """
968905 return filter (lambda x : x in string .printable , s )
969-
970-
971- def parse_frequency_support (frequency_support_str ):
972- """
973- ALMA "Frequency Support" strings have the form:
974-
975- [100.63..101.57GHz,488.28kHz, XX YY] U
976- [102.43..103.37GHz,488.28kHz, XX YY] U
977- [112.74..113.68GHz,488.28kHz, XX YY] U
978- [114.45..115.38GHz,488.28kHz, XX YY]
979-
980- at least, as far as we have seen. The "U" is meant to be the Union symbol.
981- This function will parse such a string into a list of pairs of astropy
982- Quantities representing the frequency range. It will ignore the resolution
983- and polarizations.
984- """
985- supports = frequency_support_str .split ("U" )
986- freq_ranges = [(float (sup [0 ]),
987- float (sup [1 ].split (',' )[0 ].strip (string .letters ))) *
988- u .Unit (sup [1 ].split (',' )[0 ].strip (string .punctuation +
989- string .digits ))
990- for i in supports for sup in [i .strip ('[] ' ).split ('..' ), ]]
991-
992- return freq_ranges
993-
994-
995- def approximate_primary_beam_sizes (frequency_support_str ,
996- dish_diameter = 12 * u .m , first_null = 1.220 ):
997- """
998- Using parse_frequency_support, determine the mean primary beam size in each
999- observed band
1000-
1001- Parameters
1002- ----------
1003- frequency_support_str : str
1004- The frequency support string, see `parse_frequency_support`
1005- dish_diameter : `~astropy.units.Quantity`
1006- Meter-equivalent unit. The diameter of the dish.
1007- first_null : float
1008- The position of the first null of an Airy. Used to compute resolution
1009- as :math:`R = 1.22 \lambda/D`
1010- """
1011- freq_ranges = parse_frequency_support (frequency_support_str )
1012- beam_sizes = [(first_null * fr .mean ().to (u .m , u .spectral ()) /
1013- (dish_diameter )).to (u .arcsec , u .dimensionless_angles ())
1014- for fr in freq_ranges ]
1015- return beam_sizes
0 commit comments