Circuitscape / Circuitscape.jl

Algorithms from circuit theory to predict connectivity in heterogeneous landscapes
https://circuitscape.org
MIT License
128 stars 35 forks source link

Not solving every point? #365

Open Lucavs84 opened 2 years ago

Lucavs84 commented 2 years ago

When I run Circuitscape in Julia I encounter this problem: it seems that not all points are solved. The process speeds up at some point and the cumulative current map output shows connectivity in only a part of the map. I assume that not all points are dealt with. I use Julia 1.8.1. and the latest version of Circuitscape installed by Pkg.add(PackageSpec(name="Circuitscape", rev="master")).

EXAMPLE: julia> compute("E:\ALEXANOR\UNI\RICERCA\Connectivity\circuitscape\da_parches\P_circuit.ini") [ Info: 2022-09-18 02:45:50 : Logs will recorded to file: log_file [ Info: 2022-09-18 02:45:50 : Precision used: Double [ Info: 2022-09-18 02:45:50 : Reading maps [ Info: 2022-09-18 02:45:50 : Resistance/Conductance map has 133121 nodes [ Info: 2022-09-18 02:45:52 : There are 132515 points and 7559 connected components [ Info: 2022-09-18 02:45:52 : Solving point 1 of 281 [ Info: 2022-09-18 02:45:52 : Solver used: CHOLMOD [ Info: 2022-09-18 02:45:52 : Time taken to construct cholesky factor = 0.0032751 [ Info: 2022-09-18 02:45:52 : Time taken to solve linear system = 0.0002907 seconds [ Info: 2022-09-18 02:45:52 : Solving point 2 of 281 [ Info: 2022-09-18 02:45:52 : Solver used: CHOLMOD [ Info: 2022-09-18 02:45:52 : Time taken to construct cholesky factor = 0.0043229 [ Info: 2022-09-18 02:45:52 : Time taken to solve linear system = 0.0002755 seconds [ Info: 2022-09-18 02:45:53 : Solving point 3 of 281 [ Info: 2022-09-18 02:45:53 : Solver used: CHOLMOD [ Info: 2022-09-18 02:45:53 : Time taken to construct cholesky factor = 0.0032252 [ Info: 2022-09-18 02:45:53 : Time taken to solve linear system = 0.0003644 seconds

... after some seconds...

[ Info: 2022-09-18 02:45:54 : Solving point 18 of 281 [ Info: 2022-09-18 02:45:54 : Solver used: CHOLMOD [ Info: 2022-09-18 02:45:54 : Solving point 19 of 281 [ Info: 2022-09-18 02:45:54 : Solver used: CHOLMOD [ Info: 2022-09-18 02:45:55 : Solving point 20 of 281 [ Info: 2022-09-18 02:45:55 : Solver used: CHOLMOD [ Info: 2022-09-18 02:45:55 : Solving point 21 of 281 [ Info: 2022-09-18 02:45:55 : Solver used: CHOLMOD [ Info: 2022-09-18 02:45:55 : Solving point 22 of 281 [ Info: 2022-09-18 02:45:55 : Solver used: CHOLMOD etc.

.... and finally.....

[ Info: 2022-09-18 02:46:36 : Solving point 281 of 281 [ Info: 2022-09-18 02:46:37 : Solver used: CHOLMOD [ Info: 2022-09-18 02:46:37 : Time taken to complete job = 47.2072923 281×2 Matrix{Float64}: 1.0 0.0 2.0 0.0 3.0 0.0 4.0 0.0 5.0 0.0 6.0 0.0 7.0 0.0 8.0 0.0 9.0 0.0 10.0 0.0 11.0 0.0 12.0 0.0 13.0 0.0 ⋮ 270.0 -1.0 271.0 -1.0 272.0 -1.0 273.0 -1.0 274.0 -1.0 275.0 -1.0 276.0 -1.0 277.0 -1.0 278.0 -1.0 279.0 -1.0 280.0 -1.0 281.0 -1.0

julia>

Here is my ini file settings:

<[Options for advanced mode] ground_file_is_resistances = True remove_src_or_gnd = keepall ground_file = (Browse for a ground point file) use_unit_currents = False source_file = (Browse for a current source file) use_direct_grounds = False

[Mask file] mask_file = use_mask = False

[Calculation options] low_memory_mode = False parallelize = False solver = cholmod print_timings = 0 preemptive_memory_release = False print_rusages = False max_parallel = 0

[Short circuit regions (aka polygons)] polygon_file = (Browse for a short-circuit region file) use_polygons = False

[Options for one-to-all and all-to-one modes] use_variable_source_strengths = False variable_source_file = (Browse for a source strength file)

[Output options] set_null_currents_to_nodata = False set_focal_node_currents_to_zero = False set_null_voltages_to_nodata = False compress_grids = False write_cur_maps = 1 write_volt_maps = 0 output_file = E:\ALEXANOR\UNI\RICERCA\Connectivity\circuitscape\da_parches\P_circuit.out write_cum_cur_map_only = True log_transform_maps = False write_max_cur_maps = False

[Version] version = 4.0.5

[Options for reclassification of habitat data] reclass_file = (Browse for file with reclassification data) use_reclass_table = False

[Logging Options] log_level = INFO log_file = E:\ALEXANOR\UNI\RICERCA\Connectivity\circuitscape\da_parches\P_circuit.log profiler_log_file = None screenprint_log = False

[Options for pairwise and one-to-all and all-to-one modes] included_pairs_file = (Browse for a file with pairs to include or exclude) use_included_pairs = False point_file = E:\ALEXANOR\UNI\RICERCA\Connectivity\circuitscape\da_parches\P_conn.asc

[Connection scheme for raster habitat data] connect_using_avg_resistances = False connect_four_neighbors_only = False

[Habitat raster or graph] habitat_map_is_resistances = False habitat_file = E:\ALEXANOR\UNI\RICERCA\Connectivity\circuitscape\da_parches\P_sdm.asc

[Circuitscape mode] data_type = raster scenario = all-to-one

cholmod_batch_size = 100>

Lucavs84 commented 2 years ago

Can anyone help me? Normally i not have problems running Circuitscape, but with this data I cant finda a solution. Best regards Luca

Lucavs84 commented 2 years ago

Here the files raster i have used. Could is a problem with this files? Thanks a lot

files.zip

ranjanan commented 1 year ago

Circuitscape appears to think that sources and grounds are not in any of the connected components. Let me double check if that's right.

ranjanan commented 1 year ago
[ Info: 2022-12-28 14:21:52 : There are 132515 points and 7559 connected components

There are a lot of connected components here, and it could be that some points are not connected with the others. One to all sets up an advanced problem such that a point is the source and everything else is the sink. It could be that for some points are disconnected so the one to all calculation for that point makes no sense. Could you import the rasters into a GIS and double check that the calculation makes physical sense? Just want to rule out that Circuitscape isn't already doing the right thing.

ranjanan commented 1 year ago

@Lucavs84 any update here?