We're starting off at a somewhat advanced level, but scientific writing is complicated and knowing when it's appropriate to use "which" vs. "that" can increase the clarify and precision of your writing. The difference may seem small at first, but incorrect usage can sabotage the meaning of your sentence. Let's look at an example to see what I mean:
1) "We sorted all the samples that were collected at the Lake Lucas site into categories based on morphology."
2) "We sorted all the samples, which were collected at the Lake Lucas site, into categories based on morphology."
Without knowing anything about the grammatical differences involved, you can see straight away that the "which" clause is separated from the rest of the sentence by commas. This is important, and can help you remember the essential difference between the two. Here it is:
"That" specifies a particular group of the overall subject and is crucial to the understanding of the sentence (in grammatical terms, a restrictive clause).
"Which" is followed by information that is descriptive but not necessary to understand the sentence (a non-restrictive clause). Here, the commas help to set off this clause as an aside to the main action of the sentence.
In other words, "we sorted all of the samples that were collected at the Lake Lucas site into categories" tells you that all of the sorted samples were collected at Lake Lucas and only the samples from Lake Lucas were sorted. It restricts the action of the sentence to the subset described by "that". There might be other samples, collected at other sites, that may or may not have been sorted, but we don't know anything about them from this sentence.
In the sentence "we sorted all the samples, which were collected at the Lake Lucas site, into categories", the clause introduced by a comma and "which" is more of a "by the way, here's some additional information about the samples". You can leave it out and still understand the true meaning of the sentence: "We sorted all of the samples into categories". Here, "which" is non-restrictive and descriptive: all of the samples were sorted, and they all came from Lake Lucas.
If this still seems nit-picky to you, consider the difference between these two descriptions:
1) All of the mice, which had been tested for antibodies, were given 50 mL of the solution.
2) All of the mice that had been tested for antibodies were given 50 mL of the solution.
In 1), all of the mice in the experiment were given 50 mL of the solution (and they had all been tested for antibodies). In 2), only the mice that had been tested for antibodies were given the solution (and we can infer that there are other mice, which had not been tested and were therefore not given the solution). By changing one word, we've completely changed the reader's understanding of the experimental set-up!
Recap: Clauses introduced by "which" are always set off by commas and are used to describe additional information that is nice to know about the subject. Clauses introduced by "that" are not set off by commas and they specify a subset of the subject on which the action was performed.
If you're more of a visual person and are still feeling a bit muddled on the topic, here's another short explanation, complete with color-coded Venn diagrams. Feel free to add questions or examples in the comments!