-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 28-locit-solver-for-antenna-positions
- Loading branch information
Showing
20 changed files
with
380 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ | |
from .panel import * | ||
from .combine import * | ||
from .mds import * | ||
from .gdown_utils import * | ||
from .data import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .datasets import * | ||
from ._dropbox import * | ||
from ._google_drive import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import os | ||
import shutil | ||
import requests | ||
import zipfile | ||
|
||
from tqdm import tqdm | ||
from astrohack._utils._logger._astrohack_logger import _get_astrohack_logger | ||
|
||
FILE_ID = { | ||
'ea25_cal_small_before_fixed.split.ms': | ||
{ | ||
'file':'ea25_cal_small_before_fixed.split.ms.zip', | ||
'id':'m2qnd2w6g9fhdxyzi6h7f', | ||
'rlkey':'d4dgztykxpnnqrei7jhb1cu7m' | ||
}, | ||
'ea25_cal_small_after_fixed.split.ms': | ||
{ | ||
'file':'ea25_cal_small_after_fixed.split.ms.zip', | ||
'id':'o3tl05e3qa440s4rk5owf', | ||
'rlkey':'hoxte3zzeqgkju2ywnif2t7ko' | ||
}, | ||
'J1924-2914.ms.calibrated.split.SPW3': | ||
{ | ||
'file':'J1924-2914.ms.calibrated.split.SPW3.zip', | ||
'id':'kyrwc5y6u7lxbmqw7fveh', | ||
'rlkey':'r23qakcm24bid2x2cojsd96gs' | ||
}, | ||
'extract_holog_verification.json': | ||
{ | ||
'file': 'extract_holog_verification.json', | ||
'id':'6pzucjd48a4n0eb74wys9', | ||
'rlkey':'azuynw358zxvse9i225sbl59s' | ||
}, | ||
'holog_numerical_verification.json': | ||
{ | ||
'file':'holog_numerical_verification.json', | ||
'id':'x69700pznt7uktwprdqpk', | ||
'rlkey':'bxn9me7dgnxrtzvvay7xgicmi' | ||
}, | ||
|
||
} | ||
|
||
def download(file, folder='.'): | ||
logger = _get_astrohack_logger() | ||
|
||
if os.path.exists('/'.join((folder, file))): | ||
logger.info("File exists.") | ||
return | ||
|
||
if file not in FILE_ID.keys(): | ||
logger.info("Requested file not found") | ||
|
||
return | ||
|
||
fullname=FILE_ID[file]['file'] | ||
id=FILE_ID[file]['id'] | ||
rlkey=FILE_ID[file]['rlkey'] | ||
|
||
url = 'https://www.dropbox.com/scl/fi/{id}/{file}?rlkey={rlkey}'.format(id=id, file=fullname, rlkey=rlkey) | ||
|
||
headers = {'user-agent': 'Wget/1.16 (linux-gnu)'} | ||
|
||
r = requests.get(url, stream=True, headers=headers) | ||
total = int(r.headers.get('content-length', 0)) | ||
|
||
fullname = '/'.join((folder, fullname)) | ||
|
||
with open(fullname, 'wb') as fd, tqdm( | ||
desc=fullname, | ||
total=total, | ||
unit='iB', | ||
unit_scale=True, | ||
unit_divisor=1024) as bar: | ||
for chunk in r.iter_content(chunk_size=1024): | ||
if chunk: | ||
size=fd.write(chunk) | ||
bar.update(size) | ||
|
||
if zipfile.is_zipfile(fullname): | ||
shutil.unpack_archive(filename=fullname, extract_dir=folder) | ||
|
||
# Let's clean up after ourselves | ||
os.remove(fullname) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os | ||
import astrohack | ||
|
||
from astrohack._utils._logger._astrohack_logger import _get_astrohack_logger | ||
|
||
def download(file, folder='.', unpack=False, source='dropbox'): | ||
logger = _get_astrohack_logger() | ||
|
||
if os.path.exists(folder) == False: | ||
os.mkdir(folder) | ||
|
||
if source == 'gdrive': | ||
astrohack.data._google_drive.download(file=file, folder=folder, unpack=unpack) | ||
|
||
elif source == 'dropbox': | ||
astrohack.data._dropbox.download(file=file, folder=folder) | ||
|
||
else: | ||
logger.error("unknown source or issue found") | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.