@@ -674,6 +674,7 @@ def main():
674674
675675 subparsers = parser .add_subparsers (
676676 dest = "convert_format" ,
677+ metavar = "{audio_wav,csv,qeexo_v2_csv,video}" ,
677678 title = "conversion formats" ,
678679 description = "Choose a format for file conversion" ,
679680 help = "Use '<format> --help' for format-specific options" ,
@@ -695,30 +696,32 @@ def main():
695696 parser_audio_wav_required .add_argument ("-y" , dest = "yaml" , metavar = "<yaml_file>" ,
696697 help = "YAML metadata file" , required = True )
697698
698- # Simple CSV
699- parser_simple_csv = subparsers .add_parser ("simple_csv" ,
700- help = "Convert SDS file to CSV file (single sensor)" ,
701- description = "Convert SDS file to CSV file with timeslots and data columns" ,
702- formatter_class = formatter , add_help = False )
703- parser_simple_csv_options = parser_simple_csv .add_argument_group ("options" )
704- parser_simple_csv_options .add_argument ("-h" , "--help" , action = "help" ,
705- help = "Show this help message and exit" )
706- parser_simple_csv_required = parser_simple_csv .add_argument_group ("required" )
707- parser_simple_csv_required .add_argument ("-i" , dest = "in_file" , metavar = "<input_file>" ,
708- help = "Input file" , type = in_file , required = True )
709- parser_simple_csv_required .add_argument ("-o" , dest = "out_file" , metavar = "<output_file>" ,
710- help = "Output file" , type = out_file , required = True )
711- parser_simple_csv_required .add_argument ("-y" , dest = "yaml" , metavar = "<yaml_file>" ,
712- help = "YAML metadata file" , required = True )
713- parser_simple_csv_optional = parser_simple_csv .add_argument_group ("optional" )
714- parser_simple_csv_optional .add_argument ("--normalize" , dest = "normalize" ,
715- help = "Normalize timeslots so they start with 0" , action = "store_true" )
716- parser_simple_csv_optional .add_argument ("--start-timeslot" , dest = "start_timeslot" , metavar = "<timeslot>" ,
717- help = "Starting input data timeslot, in seconds (default: %(default)s)" ,
718- type = float , default = None )
719- parser_simple_csv_optional .add_argument ("--stop-timeslot" , dest = "stop_timeslot" , metavar = "<timeslot>" ,
720- help = "Stopping input data timeslot, in seconds (default: %(default)s)" ,
721- type = float , default = None )
699+ # CSV
700+ parser_csv = subparsers .add_parser ("csv" ,
701+ help = "Convert SDS file to CSV file (single sensor)" ,
702+ description = "Convert SDS file to CSV file with timeslots and data columns" ,
703+ formatter_class = formatter , add_help = False )
704+ # Keep the old command accepted without exposing it in generated help.
705+ subparsers ._name_parser_map ["simple_csv" ] = parser_csv
706+ parser_csv_options = parser_csv .add_argument_group ("options" )
707+ parser_csv_options .add_argument ("-h" , "--help" , action = "help" ,
708+ help = "Show this help message and exit" )
709+ parser_csv_required = parser_csv .add_argument_group ("required" )
710+ parser_csv_required .add_argument ("-i" , dest = "in_file" , metavar = "<input_file>" ,
711+ help = "Input file" , type = in_file , required = True )
712+ parser_csv_required .add_argument ("-o" , dest = "out_file" , metavar = "<output_file>" ,
713+ help = "Output file" , type = out_file , required = True )
714+ parser_csv_required .add_argument ("-y" , dest = "yaml" , metavar = "<yaml_file>" ,
715+ help = "YAML metadata file" , required = True )
716+ parser_csv_optional = parser_csv .add_argument_group ("optional" )
717+ parser_csv_optional .add_argument ("--normalize" , dest = "normalize" ,
718+ help = "Normalize timeslots so they start with 0" , action = "store_true" )
719+ parser_csv_optional .add_argument ("--start-timeslot" , dest = "start_timeslot" , metavar = "<timeslot>" ,
720+ help = "Starting input data timeslot, in seconds (default: %(default)s)" ,
721+ type = float , default = None )
722+ parser_csv_optional .add_argument ("--stop-timeslot" , dest = "stop_timeslot" , metavar = "<timeslot>" ,
723+ help = "Stopping input data timeslot, in seconds (default: %(default)s)" ,
724+ type = float , default = None )
722725
723726 # Qeexo V2 CSV
724727 parser_qeexo_v2_csv = subparsers .add_parser ("qeexo_v2_csv" ,
@@ -775,6 +778,8 @@ def main():
775778 sys .exit (1 )
776779
777780 args = parser .parse_args ()
781+ if args .convert_format == "simple_csv" :
782+ args .convert_format = "csv"
778783
779784 if not isinstance (args .in_file , list ):
780785 args .in_file = [args .in_file ]
@@ -836,20 +841,20 @@ def main():
836841 if args .interval == 0 :
837842 sys .exit (f"Invalid interval option: { args .interval } ms" )
838843 write_SDS_QeexoV2CSV (args , data , meta_data )
839- elif args .convert_format == "simple_csv " :
844+ elif args .convert_format == "csv " :
840845 # Only used for one sensor
841846 if (len (args .yaml ) > 1 ) or (len (sds_files ) > 1 ):
842- sys .exit ("Simple CSV file format only supports 1 metadata and 1 SDS file" )
843- requireValueMetadata (meta_data [sensor_name [0 ]], "Simple CSV" )
847+ sys .exit ("CSV file format only supports 1 metadata and 1 SDS file" )
848+ requireValueMetadata (meta_data [sensor_name [0 ]], "CSV" )
844849 createCSV (filename )
845850 write_SDS_SimpleCSV (args , data [sensor_name [0 ]], meta_data [sensor_name [0 ]])
846851 else :
847852 readCSV (filename )
848853
849854 if args .convert_format == "qeexo_v2_csv" :
850855 write_QeexoV2CSV_SDS (args .sds_index )
851- elif args .convert_format == "simple_csv " :
852- sys .exit ('Simple CSV to SDS conversion is not supported.' )
856+ elif args .convert_format == "csv " :
857+ sys .exit ('CSV to SDS conversion is not supported.' )
853858
854859 # WAV
855860 elif "wav" in args .convert_format :
0 commit comments