16
16
from sans .common .constant_containers import SANSInstrument_string_as_key_NoInstrument
17
17
from sans .common .enums import SaveType
18
18
19
+ FILE_FORMAT_DOC_SUFFIX = (
20
+ "Note that if file formats of the same type, e.g. .xml are chosen, then the file format is appended to the file name."
21
+ )
22
+
19
23
20
24
class SANSSave (DataProcessorAlgorithm ):
21
25
def category (self ):
@@ -50,54 +54,49 @@ def PyInit(self):
50
54
"Nexus" ,
51
55
False ,
52
56
direction = Direction .Input ,
53
- doc = "Save as nexus format. "
54
- "Note that if file formats of the same type, e.g. .xml are chosen, then the "
55
- "file format is appended to the file name." ,
57
+ doc = "Save as nexus format. " + FILE_FORMAT_DOC_SUFFIX ,
56
58
)
57
59
self .declareProperty (
58
60
"CanSAS" ,
59
61
False ,
60
62
direction = Direction .Input ,
61
- doc = "Save as CanSAS xml format."
62
- "Note that if file formats of the same type, e.g. .xml are chosen, then the "
63
- "file format is appended to the file name." ,
63
+ doc = "Save as CanSAS xml format. " + FILE_FORMAT_DOC_SUFFIX ,
64
64
)
65
65
self .declareProperty (
66
66
"NXcanSAS" ,
67
67
False ,
68
68
direction = Direction .Input ,
69
- doc = "Save as NXcanSAS format."
70
- "Note that if file formats of the same type, e.g. .xml are chosen, then the "
71
- "file format is appended to the file name." ,
69
+ doc = "Save as NXcanSAS format. " + FILE_FORMAT_DOC_SUFFIX ,
70
+ )
71
+ self .declareProperty (
72
+ "PolarizedNXcanSAS" ,
73
+ False ,
74
+ direction = Direction .Input ,
75
+ doc = "Save in PolarizedNXcanSAS format. " + FILE_FORMAT_DOC_SUFFIX ,
72
76
)
73
77
self .declareProperty (
74
78
"NistQxy" ,
75
79
False ,
76
80
direction = Direction .Input ,
77
- doc = "Save as Nist Qxy format."
78
- "Note that if file formats of the same type, e.g. .xml are chosen, then the "
79
- "file format is appended to the file name." ,
81
+ doc = "Save as Nist Qxy format. " + FILE_FORMAT_DOC_SUFFIX ,
80
82
)
81
83
self .declareProperty (
82
84
"RKH" ,
83
85
False ,
84
86
direction = Direction .Input ,
85
- doc = "Save as RKH format."
86
- "Note that if file formats of the same type, e.g. .xml are chosen, then the "
87
- "file format is appended to the file name." ,
87
+ doc = "Save as RKH format. " + FILE_FORMAT_DOC_SUFFIX ,
88
88
)
89
89
self .declareProperty (
90
90
"CSV" ,
91
91
False ,
92
92
direction = Direction .Input ,
93
- doc = "Save as CSV format."
94
- "Note that if file formats of the same type, e.g. .xml are chosen, then the "
95
- "file format is appended to the file name." ,
93
+ doc = "Save as CSV format. " + FILE_FORMAT_DOC_SUFFIX ,
96
94
)
97
95
98
96
self .setPropertyGroup ("Nexus" , "FileFormats" )
99
97
self .setPropertyGroup ("CanSAS" , "FileFormats" )
100
98
self .setPropertyGroup ("NXCanSAS" , "FileFormats" )
99
+ self .setPropertyGroup ("PolarizedNXcanSAS" , "FileFormats" )
101
100
self .setPropertyGroup ("NistQxy" , "FileFormats" )
102
101
self .setPropertyGroup ("RKH" , "FileFormats" )
103
102
self .setPropertyGroup ("CSV" , "FileFormats" )
@@ -239,6 +238,7 @@ def validateInputs(self):
239
238
errors .update ({"Nexus" : "At least one data format needs to be specified." })
240
239
errors .update ({"CanSAS" : "At least one data format needs to be specified." })
241
240
errors .update ({"NXcanSAS" : "At least one data format needs to be specified." })
241
+ errors .update ({"PolarizedNXcanSAS" : "At least one data format needs to be specified" })
242
242
errors .update ({"NistQxy" : "At least one data format needs to be specified." })
243
243
errors .update ({"RKH" : "At least one data format needs to be specified." })
244
244
errors .update ({"CSV" : "At least one data format needs to be specified." })
@@ -252,8 +252,8 @@ def validateInputs(self):
252
252
" only. This requires all axes to be numeric."
253
253
}
254
254
)
255
- polarization_props = self .getProperty ("PolarizationProps" ). value
256
- if len ( polarization_props ) > 0 :
255
+ if self .getProperty ("PolarizedNXcanSAS" ):
256
+ polarization_props = self . getProperty ( "PolarizationProps" ). value
257
257
# TODO: Get these directly from the algorithm.
258
258
mandatory_props = [
259
259
"InputSpinStates" ,
@@ -275,6 +275,7 @@ def _get_file_formats(self):
275
275
self ._check_file_types (file_types , "Nexus" , SaveType .NEXUS )
276
276
self ._check_file_types (file_types , "CanSAS" , SaveType .CAN_SAS )
277
277
self ._check_file_types (file_types , "NXcanSAS" , SaveType .NX_CAN_SAS )
278
+ self ._check_file_types (file_types , "PolarizedNXcanSAS" , SaveType .POL_NX_CAN_SAS )
278
279
self ._check_file_types (file_types , "NistQxy" , SaveType .NIST_QXY )
279
280
self ._check_file_types (file_types , "RKH" , SaveType .RKH )
280
281
self ._check_file_types (file_types , "CSV" , SaveType .CSV )
@@ -289,6 +290,9 @@ def _get_file_formats(self):
289
290
# SaveNXcanSAS clashes with SaveNexusProcessed
290
291
self .add_file_format_with_appended_name_requirement (file_formats , SaveType .NX_CAN_SAS , file_types , [])
291
292
293
+ # SavePolarizedNXcanSAS clashes with SaveNXcanSAS
294
+ self .add_file_format_with_appended_name_requirement (file_formats , SaveType .POL_NX_CAN_SAS , file_types , [SaveType .NX_CAN_SAS ])
295
+
292
296
# SaveNISTDAT clashes with SaveRKH, both can save to .dat
293
297
self .add_file_format_with_appended_name_requirement (file_formats , SaveType .NIST_QXY , file_types , [SaveType .RKH ])
294
298
0 commit comments