Skip to content

Commit 07a7682

Browse files
updates in the DataSources api reference
1 parent 112f6ad commit 07a7682

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/ansys/dpf/core/data_sources.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,17 @@ def guess_result_key(filepath: str) -> str:
200200
Gives the result key for the result file of the given path
201201
202202
>>> from ansys.dpf import core as dpf
203+
>>> from ansys.dpf.core import examples
203204
>>>
204205
>>> # Create the DataSources object
205206
>>> my_data_sources = dpf.DataSources()
207+
>>> # Download the result files
208+
>>> path = examples.find_simple_bar()
209+
>>> # Define the path where the main result file can be found
210+
>>> my_data_sources.set_result_file_path(filepath=path)
206211
>>> # Define the extension key for the file in the given path
207-
>>> my_file_key = my_data_sources.guess_result_key(filepath=r'file.extension1234')
208-
'extension1234'
212+
>>> my_file_key = my_data_sources.guess_result_key(filepath=path)
213+
'rst'
209214
210215
"""
211216
result_keys = ["d3plot", "binout"]
@@ -241,11 +246,13 @@ def guess_second_key(filepath: str) -> str:
241246
>>> paths = examples.download_fluent_axial_comp()
242247
>>> # Create the DataSources object
243248
>>> my_data_sources = dpf.DataSources()
244-
>>> # Define the extensions keys for the files in the given paths
249+
>>> # Define the path where the main result file can be found
245250
>>> # We see that the paths are given in a dictionary.
246251
>>> # So to choose the correct file you need to give as an argument:
247252
>>> # - the list label
248253
>>> # - the file index in that list
254+
>>> my_data_sources.set_result_file_path(filepath=paths['cas'][0])
255+
>>> # Define the extension key for the file in the given path
249256
>>> my_file_key = my_data_sources.guess_second_key(filepath=paths['cas'][0])
250257
'cas'
251258
@@ -383,7 +390,7 @@ def add_domain_file_path(
383390
>>> # Define the path where the main result data can be found and specify its domain
384391
>>> my_data_sources.set_domain_result_file_path(path='/tmp/ds.cas', key='cas', domain_id=1)
385392
>>> # Add the additional result data to the DataSources object and specify its domain
386-
>>> my_data_sources.add_domain_file_path(path='/tmp/ds.dat', key="dat", domain_id=1)
393+
>>> my_data_sources.add_domain_file_path(filepath='/tmp/ds.dat', key="dat", domain_id=1)
387394
388395
"""
389396
# The filename needs to be a fully qualified file name
@@ -602,7 +609,7 @@ def result_files(self):
602609
>>>
603610
>>> # Get the path to the main result file of the main DataSources object
604611
>>> my_data_sources.result_files
605-
[..\\.venv\\Lib\\site-packages\\ansys\\dpf\\core\\examples\\result_files\\msup\\file.rfrq']
612+
['../site-packages/ansys/dpf/core/examples/result_files/msup/file.rfrq']
606613
607614
- If you are checking the DataSources object created to define the upstream data, only the first one is listed.
608615

0 commit comments

Comments
 (0)