Stanford-STAGES / stanford-stages

Automated sleep staging scoring and narcolepsy identification
76 stars 26 forks source link

Add warnings for unrecognized options in the JSON file #28

Open informaton opened 4 years ago

informaton commented 4 years ago

Posted for Steve:

There are still hard-coded paths in inf_config.py [lines 54-56]. Also, the JSON attributes that appear to correspond to those hard-coded variables have slightly different names in 2/3 cases. Thus the JSON inputs don't override those values, and the app tries to use a hard-coded path for a Windows system on my Linux box. From inf_config.py:

54        self.psg_noise_file_pathname = 'F:/ml/noiseM.mat'
55        self.hypnodensity_model_root_path = 'F:/ml/'
56        self.hypnodensity_scale_path = 'F:/ml/scaling/'

From stanford_stages.json:

13        "hypnodensity_model_dir": "~/StanfordStages/stanford-stages/ml/ac/",
14        "hypnodensity_scale_path": "~/StanfordStages/stanford-stages/ml/scaling",
15        "psg_noise_filename": "~/StanfordStages/stanford-stages/ml/noiseM.mat",

And from my runtime AppConfig object when making the call to inf_narco_app:

# Does not contain psg_noise_filename or hypnodensity_model_dir
{'psg_noise_file_pathname': 'F:/ml/noiseM.mat', 'hypnodensity_model_root_path': 'F:/ml/', hypnodensity_scale_path': '~/StanfordStages/stanford-stages/ml/scaling'}

More generally, you might consider issuing at least a warning if there are any unrecognized options in the JSON file (for catching typos, for instance).

informaton commented 4 years ago

Yes, you are right about the hard coded names there. The original instructions were to update the inf_config.py directly to make the changes. It sounds like it may be best and easiest for you to update the inf_config.py file's settings directly rather than following the instructions for using the json parameters because of some of the differences. Good idea about flagging unrecognized options. I'll add it as a feature request (i.e. here).