Changeset 3336
- Timestamp:
- 05/12/08 16:48:00 (2 months ago)
- Files:
-
- 1 modified
-
trunk/opus_core/choice_model.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/opus_core/choice_model.py
r3265 r3336 29 29 from opus_core.class_factory import ClassFactory 30 30 from opus_core.model import get_specification_for_estimation, prepare_specification_and_coefficients 31 from opus_core.variables.variable_name import VariableName 31 32 from opus_core.logger import logger 32 33 from numpy import where, zeros, array, arange, ones, take, ndarray, resize, concatenate … … 76 77 self.debug = DebugPrinter(debuglevel) 77 78 79 self.compute_choice_attribute = False 80 self.choice_attribute_name = choice_attribute_name 81 if (self.choice_attribute_name is not None): 82 self.choice_attribute_name = VariableName(self.choice_attribute_name) 83 if self.choice_attribute_name.get_package_name() is not None: 84 self.compute_choice_attribute = True 85 78 86 if not isinstance(choice_set, Dataset): 79 87 storage = StorageFactory().get_storage('dict_storage') 80 88 storage_table_name = 'choice_set' 81 table_data = { choice_attribute_name:array(choice_set)}89 table_data = {self.choice_attribute_name.get_alias():array(choice_set)} 82 90 storage.write_table( 83 91 table_name=storage_table_name, … … 88 96 in_storage = storage, 89 97 in_table_name = storage_table_name, 90 id_name = choice_attribute_name,98 id_name = self.choice_attribute_name.get_alias(), 91 99 dataset_name = 'choice', 92 100 ) … … 132 140 agents_index=arange(agent_set.size()) 133 141 142 if self.compute_choice_attribute: 143 agent_set.compute_variables([self.choice_attribute_name], dataset_pool=self.dataset_pool) 144 134 145 if self.run_config.get("demand_string", None): 135 146 self.choice_set.add_primary_attribute(name=self.run_config.get("demand_string"), … … 269 280 agents_index=array(agents_index) 270 281 282 if self.compute_choice_attribute: 283 agent_set.compute_variables([self.choice_attribute_name], dataset_pool=self.dataset_pool) 284 271 285 self.model_interaction.set_agent_set(agent_set) 272 286
