88import json
99import shutil
1010import numpy as np
11+ from pathlib import Path
12+
1113
1214from scipy .ndimage import gaussian_filter
1315from time import time
@@ -437,9 +439,9 @@ def find_Bragg_disks_aiml_serial(
437439 raise ImportError ("Import Error: Please install crystal4D before proceeding" )
438440
439441 # Make the peaks PointListArray
440- # dtype = [('qx', float),('qy', float),(' intensity', float)]
441- peaks = BraggVectors (datacube .Rshape , datacube .Qshape )
442-
442+ dtype = [("qx" , float ), ( "qy" , float ), ( " intensity" , float )]
443+ # peaks = BraggVectors(datacube.Rshape, datacube.Qshape)
444+ peaks = PointListArray ( dtype = dtype , shape = ( datacube . R_Nx , datacube . R_Ny ))
443445 # check that the filtered DP is the right size for the probe kernel:
444446 if filter_function :
445447 assert callable (filter_function ), "filter_function must be callable"
@@ -518,7 +520,7 @@ def find_Bragg_disks_aiml_serial(
518520 subpixel = subpixel ,
519521 upsample_factor = upsample_factor ,
520522 filter_function = filter_function ,
521- peaks = peaks .vectors_uncal . get_pointlist (Rx , Ry ),
523+ peaks = peaks .get_pointlist (Rx , Ry ),
522524 model_path = model_path ,
523525 )
524526 t2 = time () - t0
@@ -884,7 +886,7 @@ def _get_latest_model(model_path=None):
884886 + "https://www.tensorflow.org/install"
885887 + "for more information"
886888 )
887- from py4DSTEM .io .google_drive_downloader import download_file_from_google_drive
889+ from py4DSTEM .io .google_drive_downloader import gdrive_download
888890
889891 tf .keras .backend .clear_session ()
890892
@@ -894,7 +896,12 @@ def _get_latest_model(model_path=None):
894896 except :
895897 pass
896898 # download the json file with the meta data
897- download_file_from_google_drive ("FCU-Net" , "./tmp/model_metadata.json" )
899+ gdrive_download (
900+ "FCU-Net" ,
901+ destination = "./tmp/" ,
902+ filename = "model_metadata.json" ,
903+ overwrite = True ,
904+ )
898905 with open ("./tmp/model_metadata.json" ) as f :
899906 metadata = json .load (f )
900907 file_id = metadata ["file_id" ]
@@ -918,7 +925,8 @@ def _get_latest_model(model_path=None):
918925 else :
919926 print ("Checking the latest model on the cloud... \n " )
920927 filename = file_path + file_type
921- download_file_from_google_drive (file_id , filename )
928+ filename = Path (filename )
929+ gdrive_download (file_id , destination = "./tmp" , filename = filename .name )
922930 try :
923931 shutil .unpack_archive (filename , "./tmp" , format = "zip" )
924932 except :
0 commit comments