3dem / model-angelo

Automatic atomic model building program for cryo-EM maps
MIT License
116 stars 18 forks source link

local variable 'grid_np' referenced before assignment - model_angelo/c_alpha/inference.py #45

Closed DHouldershaw closed 1 year ago

DHouldershaw commented 1 year ago

Hi, Just upgraded our model_angelo to the lastest and now get an error:

2023-05-19 at 12:30:30 | INFO | Using model file /s/ems/s/model_angelo_weights/hub/checkpoints/model_angelo_v1.0/nucleotides/c_alpha/model.py 2023-05-19 at 12:30:30 | INFO | Using checkpoint file /s/ems/s/model_angelo_weights/hub/checkpoints/model_angelo_v1.0/nucleotides/c_alpha/chkpt.torch 2023-05-19 at 12:30:30 | ERROR | Error in ModelAngelo Traceback (most recent call last):

File "/s/ems/s/anaconda/v4.8.4/envs/model_angelo/bin/model_angelo", line 33, in sys.exit(load_entry_point('model-angelo==1.0.1', 'console_scripts', 'model_angelo')()) │ │ └ <function importlib_load_entry_point at 0x7f59615d10d0> │ └ └ <module 'sys' (built-in)> File "/s/ems/s/anaconda/v4.8.4/envs/model_angelo/lib/python3.9/site-packages/model_angelo-1.0.1-py3.9.egg/model_angelo/main.py", line 52, in main args.func(args) │ │ └ Namespace(volume_path='sharpened_map.ccp4', protein_fasta='TB_23nov22_data.fasta', rna_fasta=None, dna_fasta=None, output_dir... │ └ <function main at 0x7f587d376d30> └ Namespace(volume_path='sharpened_map.ccp4', protein_fasta='TB_23nov22_data.fasta', rna_fasta=None, dna_fasta=None, output_dir...

File "/s/ems/s/anaconda/v4.8.4/envs/model_angelo/lib/python3.9/site-packages/model_angelo-1.0.1-py3.9.egg/model_angelo/apps/build.py", line 207, in main ca_cif_path = c_alpha_infer(ca_infer_args) │ └ {'model_checkpoint': 'chkpt.torch', 'bfactor': 0, 'batch_size': 4, 'box_size': 64, 'stride': 16, 'dont_mask_input': True, 'th... └ <function infer at 0x7f587de0f9d0> File "/s/ems/s/anaconda/v4.8.4/envs/model_angelo/lib/python3.9/site-packages/model_angelo-1.0.1-py3.9.egg/model_angelo/c_alpha/inference.py", line 176, in infer mask_grid = np.ones_like(grid_np) │ └ <function ones_like at 0x7f58d7d97430> └ <module 'numpy' from '/s/ems/s/anaconda/v4.8.4/envs/model_angelo/lib/python3.9/site-packages/numpy/init.py'>

UnboundLocalError: local variable 'grid_np' referenced before assignment

I'm running model_angelo without a mask - just a volume and a fasta seq, which worked fine in the previous version. Any help ? Many thanks, Cheers, Dave H.

DHouldershaw commented 1 year ago

Ok, fixed my own issue :) My map file ended in ccp4 not mrc and that is why grid_np didn't get set.